Javatpoint Logo
Javatpoint Logo

JavaScript String toString() Method

The JavaScript toString() method returns a string representing the calling object. In other words, this method provides a string representation of the object and treats same as the valueof() method.

Syntax

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

Returns

A String representing the object

JavaScript String toString() Method Example

Let's see some simple examples of toString() method.

Example 1

Here, we will print the value of string object.

Test it Now

Output:

Javatpoint

Example 2

Let's see one more example to print the value of string object.

Test it Now

Output:

Javatpoint

Next TopicJavaScript String




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA