Skip to content

Calling a JavaScript function from .NET

paulbartrum edited this page Dec 14, 2015 · 3 revisions

You can also call a JavaScript function from .NET.

var engine = new Jurassic.ScriptEngine();
engine.Evaluate("function test(a, b) { return a + b }");
Console.WriteLine(engine.CallGlobalFunction<int>("test", 5, 6));

This code outputs "11" to the console.

Next tutorial: Exposing a .NET class to JavaScript