Javatpoint Logo
Javatpoint Logo

JavaScript String valueOf() Method

The JavaScript string valueOf() method is used to find out the primitive value of String object. This method is invoked by JavaScript automatically. Thus, there is no requirement to call it explicitly in the code.

Syntax

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

Returns

A string representing the primitive value of string object.

JavaScript String valueOf() Method Example

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

Example 1

Here, we will print the primitive value of string object.

Test it Now

Output:

Javatpoint

Example 2

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

Test it Now

Output:

Javatpoint

Next TopicJavaScript String




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA