Javascript Number toString()

Introduction

The Javascript Number toString() method converts Number object to String.

numObj.toString([radix])
Parameter Optional Meaning
radix Optional.An integer in the range 2 through 36 specifying the base.

If the radix is not specified, the preferred radix is assumed to be 10.

let count = 10;//from  w w w .  j ava2 s. co  m

console.log(count.toString());    
console.log((17).toString());     
console.log((17.2).toString());   

let x = 6;

console.log(x.toString(2));      
console.log((254).toString(16)); 

console.log((-10).toString(2));  
console.log((-0xff).toString(2));



PreviousNext

Related