-
Hello! When I using the JS Spread syntax (...) to construct an another object with extra props, its not working as expected: engine.Execute("test = (x) => { return {...x, 'newProp':'yeee'}; }");
var result = engine.Invoke("test", "{'name':'John','age':30}"); The result contains only the
but the expected is:
Tell me if i'm doing something wrong :) |
Beta Was this translation helpful? Give feedback.
Answered by
lahma
Nov 3, 2022
Replies: 1 comment 1 reply
-
You are invoking function |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
berkid89
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are invoking function
test
with string parameter that has value"{'name':'John','age':30}"
so you are trying to spread string. This shows the difference and expected outputvar result = engine.Evaluate("test({'name':'John','age':30})")
, here's object parameter instead of string.