Javatpoint Logo
Javatpoint Logo

JavaScript Number toString() method

The JavaScript number toString() method converts the given number into the string and returns it.

Syntax

The toString() method is represented by the following syntax:

Parameter

radix - It is optional. An integer between 2 and 36 that represents the numeral system to be used.

Return

The given number in the form of string.

JavaScript Number toString() method example

Here, we will understand toString() method through various examples.

Example 1

Let's see a simple example of toString() method.

Test it Now

Output:

50
-50
50.25

Example 2

Let's see an example to add two numbers with and without using toString() method.

Test it Now

Output:

Before invoking toString(): 80
After invoking toString(): 5030

Example 3

In this example, we will pass radix argument within toString() method.

Test it Now

Output:

1100
14
c

Next TopicJavaScript Number




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA