Javascript closure support?

function greeter(whatToGreet)
{
    return function() { Demo.print("hello " + whatToGreet + "!"); };
}
Demo.print( greeter("closure")() );

the code above will print hello undefined!
It seems javascript engine doesn’t support closure, Is there some plan to support this feature?

The JUCE Javascript implementation is fairly minimal - if you want full modern JS support you might want to look at adding V8, Spidermonkey or another embedded JS engine to your project.

1 Like

Integrating duktape isn’t totally crazy either. It’s pretty lightweight and is straightforward enough to set up and use.

1 Like

wow, this library is exactly what i want. Althouth not as fancy as v8, but simple and powerful enough.
Thank you very much!