• tostring(10) does not work.
    I'm trying to convert hex to dec, what's the problem?
    My code:
    print((31).toString(10)); //returns 31
    print((31).toString(16)); //returns 1f

    figured out th problem by myself :)
    it is necessary to write so:
    print((0x31).toString(10)); // returns 49

  • ...changing the conversation title to - for example - How to define and print hex / hexa decimal values would give it a good positive spin... ;)

  • Just done... @user79559 thanks for posting up when you found the answer!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to define and print hex/hexadecimal values in JS

Posted by Avatar for Alexandr @Alexandr

Actions