Please can you post up a full code example, as well as what version of Espruino you're using?
@Gordon started
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.
Please can you post up a full code example, as well as what version of Espruino you're using?