.apply isn't really like .map - it just calls the function once, but with the arguments in the array. Calling String.fromCharCode(32,33,34,35,36,...) just returns one string with all those characters in it.
It's actually pretty horrible to do in Espruino since it ends up creating a sparse array for all the arguments, but on the desktop it's a really handy shortcut ;)
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.
.apply
isn't really like.map
- it just calls the function once, but with the arguments in the array. CallingString.fromCharCode(32,33,34,35,36,...)
just returns one string with all those characters in it.It's actually pretty horrible to do in Espruino since it ends up creating a sparse array for all the arguments, but on the desktop it's a really handy shortcut ;)