JavaScript Number toString() methodThe JavaScript number toString() method converts the given number into the string and returns it. SyntaxThe toString() method is represented by the following syntax: Parameterradix - It is optional. An integer between 2 and 36 that represents the numeral system to be used. ReturnThe given number in the form of string. JavaScript Number toString() method exampleHere, we will understand toString() method through various examples. Example 1Let's see a simple example of toString() method. Test it NowOutput: 50 -50 50.25 Example 2Let's see an example to add two numbers with and without using toString() method. Test it NowOutput: Before invoking toString(): 80 After invoking toString(): 5030 Example 3In this example, we will pass radix argument within toString() method. Test it NowOutput: 1100 14 c Next TopicJavaScript Number |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India