mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-30 19:08:42 +07:00
15 lines
438 B
Markdown
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;
|
|
```
|