Files
n8n-docs/docs/code-examples/javascript-functions/methods-variables/evaluate-expression.md
2022-08-30 16:36:31 +01:00

15 lines
438 B
Markdown

# $evaluateExpression(expression: string, itemIndex: number)
Evaluates a given string as expression.
If no `itemIndex` is provided it uses by default in the Function-Node the data of item 0 and
in the Function Item-Node the data of the current item.
Example:
```javascript
items[0].json.variable1 = $evaluateExpression('{{1+2}}');
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);
return items;
```