This method returns a string representing the specified object. The toString() method parses its first argument, and attempts to return a string representation in the specified radix (base).
number.toString( [radix] )
radix − An integer between 2 and 36 specifying the base to use for representing numeric values.
Returns a string representing the specified Number object.
var num = new Number(10); console.log(num.toString()); console.log(num.toString(2)); console.log(num.toString(8));
On compiling, it will generate the same code in JavaScript.
The code will produce the following output −
10 1010 12