d[18] is like d.substr(18,1) - so it still returns a string. But in JavaScript numeric strings are treated as numbers when involved in maths, so it's just a 1 or a 0.
Not great, but it's buried deep in a module, and users will be more worried about it being small and fast :)
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.
d[18]
is liked.substr(18,1)
- so it still returns a string. But in JavaScript numeric strings are treated as numbers when involved in maths, so it's just a1
or a0
.Not great, but it's buried deep in a module, and users will be more worried about it being small and fast :)