You can also refer to http://forum.espruino.com/conversations/353421 which is similar to your issue. I would again recommend the INA219 or INA226 for voltage detection if you're not familiar with voltage dividers, because there is a big risk of you frying your device if you mess up the voltages.
At least with the INA219/INA226 they're cheap so even if you fry them they don't cost that much :P
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.
You can also refer to http://forum.espruino.com/conversations/353421 which is similar to your issue. I would again recommend the INA219 or INA226 for voltage detection if you're not familiar with voltage dividers, because there is a big risk of you frying your device if you mess up the voltages.
At least with the INA219/INA226 they're cheap so even if you fry them they don't cost that much :P