This article mainly introduces the toString () method of the Number object in javascript, and analyzes in detail the usage and precautions of the toString () method, which is of great practical value, for more information about how to define and use the toString () method, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:
This method can convert a Number object to a string and return this string.
The syntax structure is as follows:
The Code is as follows:
NumberObject. toString (radix)
Parameter List:
Parameters |
Description |
Radix |
Optional. Indicates the base number of a number, so that 2 ~ An integer between 36. If this parameter is omitted, base 10 is used. Note that if this parameter is a value other than 10, the ECMAScript standard allows any value to be returned. |
The instance code is as follows:
The Code is as follows:
Var a = new Number (3 );
Console. log (a. toString ());
Output result: 3.
I hope this article will help you design javascript programs.