I'm attempting to pass an object to a javascript function via jint and return a value. But it doesn't seem to work. Here is what I have tried so far -
Error -
Jint.Runtime.JavaScriptException: 'obj is undefined'
Using the following code -
var carObj = JsonSerializer.Serialize(car);
var engine = new Jint.Engine();
engine.SetValue("obj", carObj);
var value = engine
.Execute("const result = (function car(obj) { const type = obj.Type; return type;})()")
.GetValue("result");