mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-30 02:48:41 +07:00
22 lines
471 B
Markdown
22 lines
471 B
Markdown
---
|
|
contentType: reference
|
|
---
|
|
|
|
# `$evaluateExpression(expression: string, itemIndex?: number)`
|
|
|
|
Evaluates a given string as expression.
|
|
|
|
If you don't provide `itemIndex`, n8n uses:
|
|
|
|
* The data from item 0 in the Code node.
|
|
* The data from the current item in the Function Item node.
|
|
|
|
Example:
|
|
|
|
```javascript
|
|
items[0].json.variable1 = $evaluateExpression('{{1+2}}');
|
|
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);
|
|
|
|
return items;
|
|
```
|