Core JavaScript 1.5 Reference:Global Objects:String:toString
From MDC
(Redirected from Core JavaScript 1.5 Reference:Objects:String:toString)
Contents |
[edit] Summary
Returns a string representing the specified object.
| Method of String | |
| Implemented in: | JavaScript 1.1, NES2.0 |
| ECMA Version: | ECMA-262 |
[edit] Syntax
toString()
[edit] Parameters
None.
[edit] Description
The String object overrides the toString method of the Object object; it does not inherit Object.toString. For String objects, the toString method returns a string representation of the object.
[edit] Examples
[edit] Example: Using toString
The following example displays the string value of a String object:
x = new String("Hello world");
alert(x.toString()) // Displays "Hello world"