Jean-Philippe_Rey and Gordon thank you very much for your help, it works the way i want it to now, i knew it was something with the quotes but couldn't figure it out.
For any one else that wants to achieve something similar, this is the code:
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.
Jean-Philippe_Rey and Gordon thank you very much for your help, it works the way i want it to now, i knew it was something with the quotes but couldn't figure it out.
For any one else that wants to achieve something similar, this is the code: