mozilla

Compare Revisions

String.prototype.toString()

Change Revisions

Revision 87732:

Revision 87732 by evilpie on

Revision 335589:

Revision 335589 by ethertank on

Title:
toString
String.toString
Slug:
JavaScript/Reference/Global_Objects/String/toString
JavaScript/Reference/Global_Objects/String/toString
Tags:
"String", "String Methods"
Content:

Revision 87732
Revision 335589
n7    <p>n
8      &nbsp;
9    </p>
10    <h3 id="Summary" name="Summary">7    <h2 id="Summary" name="Summary">
n12    </h3>n9    </h2>
n20            Method of <a href="/en/JavaScript/Reference/Global_Obn17            Method of <a href="/en-US/docs/JavaScript/Reference/G
>jects/String"><code>String</code></a>>lobal_Objects/String"><code>String</code></a>
n43    <h3 id="Syntax" name="Syntax">n40    <h2 id="Syntax" name="Syntax">
n45    </h3>n42    </h2>
46    <p>43    <pre class="syntaxbox">
47      <code><em>string</em>.toString()</code>44<code><em>string</em>.toString()</code>
48    </p>45</pre>
n55    <h3 id="Description" name="Description">n52    <h2 id="Description" name="Description">
nn54    </h2>
55    <p>
56      The <code>String</code> object overrides the <code>toString
 ></code> method of the <a href="/en-US/docs/JavaScript/Reference/G
 >lobal_Objects/Object" title="JavaScript/Reference/Global_Objects/
 >Object"><code>Object</code></a> object; it does not inherit <a hr
 >ef="/en-US/docs/JavaScript/Reference/Global_Objects/Object/toStri
 >ng" title="JavaScript/Reference/Global_Objects/Object/toString"><
 >code>Object.toString</code></a>. For <code>String</code> objects,
 > the <code>toString</code> method returns a string representation
 > of the object.
57    </p>
58    <h2 id="Examples" name="Examples">
59      Examples
60    </h2>
61    <h3 id="Example:_Using_toString" name="Example:_Using_toStrin
 >g">
62      Example: Using <code>toString</code>
n58    <p>n
59      The <code>String</code> object overrides the <code>toString
></code> method of the <code><a href="/en/JavaScript/Reference/Glo 
>bal_Objects/Object" title="en/JavaScript/Reference/Global_Objects 
>/Object">Object</a></code> object; it does not inherit <code><a h 
>ref="/en/JavaScript/Reference/Global_Objects/Object/toString" tit 
>le="en/JavaScript/Reference/Global_Objects/Object/toString">Objec 
>t.toString</a></code>. For <code>String</code> objects, the <code 
>>toString</code> method returns a string representation of the ob 
>ject. 
60    </p>
61    <h3 id="Examples" name="Examples">
62      Examples
63    </h3>
64    <h4 id="Example:_Using_toString" name="Example:_Using_toStrin
>g"> 
65      Example: Using <code>toString</code>
66    </h4>
n70    <pre>n67    <pre class="brush:js">
71x = new String("Hello world");68var x = new String("Hello world");
69 
n74    <h3 id="See_also" name="See_also">n72    <h2 id="See_also" name="See_also">
t76    </h3>t74    </h2>
77    <p>75    <ul>
76      <li>
78      <a href="/en/JavaScript/Reference/Global_Objects/Object/toS77        <a href="/en-US/docs/JavaScript/Reference/Global_Objects/
>tring" title="en/JavaScript/Reference/Global_Objects/Object/toStr>Object/toString" title="JavaScript/Reference/Global_Objects/Objec
>ing">Object.toString</a>>t/toString">Object.toString</a>
78      </li>
79    </p>79    </ul>
80    <p>
81      &nbsp;
82    </p>
83    <p>
84      {{ languages( { "es": "es/Referencia_de_JavaScript_1.5/Obje
>tos_globales/String/toString", "ja": "ja/Core_JavaScript_1.5_Refe 
>rence/Global_Objects/String/toString", "pl": "pl/Dokumentacja_j\u 
>0119zyka_JavaScript_1.5/Obiekty/String/toString" } ) }} 
85    </p>

Back to History