How to convert decimal to hexadecimal in JavaScript

后端 未结 27 2592
臣服心动
臣服心动 2020-11-21 23:05

How do you convert decimal values to their hexadecimal equivalent in JavaScript?

27条回答
  •  迷失自我
    2020-11-21 23:45

    var number = 3200;
    var hexString = number.toString(16);
    

    The 16 is the radix and there are 16 values in a hexadecimal number :-)

提交回复
热议问题