If you did want to measure the voltage, you'd need to divide it down with a potential divider (but then it seems for an accurate reading you also need a capacitor on the analog input).
So for example:
A capacitor (0.1uF should do it) between GND and A0
A 100k resistor between GND and A0
A 100k resistor between Battery volts (or even the 5V/vBat/VCC pin) and A0
Then analogRead(A0)*3.3*2 is your voltage.
Obviously you want to use high-value resistors for the potential divider, as they'll be constantly drawing power.
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.
If you did want to measure the voltage, you'd need to divide it down with a potential divider (but then it seems for an accurate reading you also need a capacitor on the analog input).
So for example:
Then
analogRead(A0)*3.3*2
is your voltage.Obviously you want to use high-value resistors for the potential divider, as they'll be constantly drawing power.