• I've just created a bug for this: https://github.com/espruino/Espruino/iss­ues/232

    It's more obvious if you do this:

    >a=255;a.toString(16)
    ="FF"
    >a=255.0;a.toString(16) 
    ="255"
    

    The issue is that floats and integers are treated slightly differently in Espruino. Floats are only output in decimal (at the moment), whereas integers can be output in whatever base is requested.

    So if you want to work around it, for now I'd suggest doing parseInt(a).toString(16)

About

Avatar for Gordon @Gordon started