This optional argument specifies the base that should be used to convert the number. It should be an integer between 2 and 16. If no value is specified, then base 10 is used.
The string representation of the number in the specified radix.
The toString() method of the Number object converts a Number to a string, using the specified radix or base. If no radix is specified, base 10 is used.
n = 123; s = n.toString(16);
Note, however, that because of syntactic restrictions in the language, you cannot use the toString() method on numeric literals. You must assign them to variables first; i.e., you cannot rewrite the two lines of code above as:
s = 123.toString(16);