toString()  String  instance method JS Home  <<  JS Reference  <<  String  <<  toString()

Description

Returns a string of the specified object.

This method overrides the toString() method of Object.

Syntax

Signature Description
aString.toString()Returns a string of the specified object.

Parameters

None.

Examples

The code below creates a string and displays it.


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

alert(someString.toString()); 

Press the button below to action the above code:

Related Tutorials

JavaScript Basic Tutorials - Lesson 8 - Strings