JavaScript decimal and hexadecimal system conversion

// Number.toString (the radix); 
// the radix of 2 to 36, is not written in decimal 
var NUM = 255 ;
console.log (num.toString ( 16)); // decimal convert hexadecimal 
console.log (num.toString (16) .toUpperCase ()); // Decimal turn hex, then transferred capital

// the parseInt (String, the radix) 
// the radix of 2 to 36, is not written in decimal 
var STR = "the FF" ;
the console.log (the parseInt (STR, 16)); // data from hexadecimal decimal 
var str1 = "12 is" ;
the console.log (the parseInt (str1)); // string of decimal turn

 

Guess you like

Origin www.cnblogs.com/xuqiulin/p/11924015.html