Could the pin be floating, instead of being pulled up or down? I forget which way the button is wired (ie if it goes to vcc or gnd when pressed) - set the pin to be pulled up or down as appropriate. If it's just an input, it will float when button isn't pressed, and the voltage measured on the pin will depend on ambient electromagnetic fields. That definitely sounds like a floating pin.
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.
Could the pin be floating, instead of being pulled up or down? I forget which way the button is wired (ie if it goes to vcc or gnd when pressed) - set the pin to be pulled up or down as appropriate. If it's just an input, it will float when button isn't pressed, and the voltage measured on the pin will depend on ambient electromagnetic fields. That definitely sounds like a floating pin.