Files
n8n-docs/docs/code-examples/javascript-functions/methods/evaluate-expression.md
2022-08-30 15:53:14 +01:00

438 B

$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:

items[0].json.variable1 = $evaluateExpression('{{1+2}}');
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);

return items;