JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow String Right Arrow valueOf()

valueOf()  String  instance method

Description

Returns the primitive value of a String object as a string data type.

This method is the same as calling the toString() method on a String object.

Syntax


Signature Description
aString.valueOf()Returns the primitive value of a String object as a string data type.

Parameters

None.

Examples

The code below creates a string and displays a string primitive.


// Create a String object.
someString = new String("Learn Javascript");
alert(someString.valueOf()); 

Press the button below to action the above code:

Related Tutorials

JavaScript Basic Tutorials - Lesson 8 - Strings



  

go to home page Homepage go to top of page Top