I've just checked, and it's an issue with Espruino's implementation of the Function constructor. Basically it only looks for the code to run, and not for the optional list of arguments.
So (new Function('console.log("Hello");'))() will work, but you won't be able to supply arguments.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi Tobias,
I've just checked, and it's an issue with Espruino's implementation of the
Function
constructor. Basically it only looks for the code to run, and not for the optional list of arguments.So
(new Function('console.log("Hello");'))()
will work, but you won't be able to supply arguments.I've filed a bug for it here: https://github.com/espruino/Espruino/issues/505
If you want to work around it you could do: