JavaScript: binary conversion.

Recently I made a point of some hex conversion.

Binary Decimal turn:

let a = 45;
a.toString(2); //"101101"

let b = 123;
b.toString(2); // "1111011"
toString(radix):
radix Optional. It represents a predetermined base number, so that an integer between 2 and 36. If the argument is omitted, then the radix 10. Note, however, if the parameter is any value other than 10, the ECMAScript standard allows return any value.


Guess you like

Origin www.cnblogs.com/liuyuanfang/p/10872368.html