Just to add to this, I think @allObjects has covered a lot of potential issues with your code.
Right now Espruino doesn't warn you when you use an undefined variable, so it's quite easy to accidentally use the wrong one when you're not used to programming - especially as JavaScript is case sensitive.
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.
Just to add to this, I think @allObjects has covered a lot of potential issues with your code.
Right now Espruino doesn't warn you when you use an undefined variable, so it's quite easy to accidentally use the wrong one when you're not used to programming - especially as JavaScript is case sensitive.