valueOf() String instance method getterS2C Home
« Globals « String « valueOf()
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());
Related Tutorials
JavaScript Basic Tutorials - Lesson 8 - Strings