-
Hi, I'm a newbie trying to use Jint and I've encountered a problem. I understand you get values like this: Console.WriteLine(new Engine().Execute("var x = 10;").GetValue("x")); // 10 But when I try to use the Console.WriteLine(new Engine().Execute("const x = 10;").GetValue("x")); // undefined How do I get the value of |
Beta Was this translation helpful? Give feedback.
Answered by
lahma
Jan 14, 2022
Replies: 1 comment
-
Console.WriteLine(new Engine().Execute("const x = 10;").Evaluate("x")); // 10 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Tacodiva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GetValue
resolves from object's properties, in this case from global environment's variable environment (which is basically the global object). You need to useEvaluate
get access items seen by script, in this case the lexical environment which contains let/const/class.