my test snippet:
these tests are fine:
abc(4); // prints "1" .. ok
abc(4,5,8); // prints "3" .. ok
and here is the flaw:
abc(); // prints "1" .. NOK - "0" expected (checked on browsers and node.js)
as already mentioned - it's not critical, but some libraries written for node may fail in their arguments check.
found in 1v95 on EspruinoWIFI
Thanks for letting me know! I put a bug in for it here: https://github.com/espruino/Espruino/issues/1321
You probably gathered already but it's because you specified an argument p1. Espruino doesn't keep a second arguments array for the sake of saving memory, so it reconstructs the array when you ask for it.
I think probably the sensible option for now is just to document this difference in the reference for arguments?
I guess there should probably be a page for known differences to the ES5 spec, like the newline handling and lack of unicode
at least some hint in the API doc (http://www.espruino.com/Reference#l__global_arguments) would be fine.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem