mozilla

Compare Revisions

Object.prototype.toSource()

Change Revisions

Revision 81302:

Revision 81302 by evilpie on

Revision 308887:

Revision 308887 by ethertank on

Title:
toSource
Object.toSource
Slug:
JavaScript/Reference/Global_Objects/Object/toSource
JavaScript/Reference/Global_Objects/Object/toSource
Tags:
"JavaScript"
Content:

Revision 81302
Revision 308887
n7    <p>n7    <div>
n9    </p>n9    </div>
10    <h3 id="Summary" name="Summary">10    <h2 id="Summary" name="Summary">
n12    </h3>n12    </h2>
n20            Method of <a href="/en/JavaScript/Reference/Global_Obn20            Method of <a href="/en-US/docs/JavaScript/Reference/G
>jects/Object" title="en/JavaScript/Reference/Global_Objects/Objec>lobal_Objects/Object" title="JavaScript/Reference/Global_Objects/
>t"><code>Object</code></a>>Object"><code>Object</code></a>
n43    <h3 id="Syntax" name="Syntax">n43    <h2 id="Syntax" name="Syntax">
n45    </h3>n45    </h2>
n55    <h3 id="Description" name="Description">n55    <h2 id="Description" name="Description">
n57    </h3>n57    </h2>
n78      It is safe for objects to override the <code>toSource</coden78      It is safe for objects to override the <code>toSource</code
>> method.&nbsp; For example:>> method. For example:
n80    <pre>n80    <pre class="brush:js">
nn84 
nn88 
87alert(new Person("Joe").toSource());    // ---&gt; new Person("Jo89alert(new Person("Joe").toSource()); // ---&gt; new Person("Joe")
>e") 
n89    <h4 id="Built-in_toString_methods" name="Built-in_toString_men91    <h3 id="Built-in_toString_methods" name="Built-in_toString_me
>thods">>thods">
n91    </h4>n93    </h3>
n93      Each core JavaScript type has its own <code>toSource</code>n95      Each core JavaScript type has its own <code>toSource</code>
> method. These objects are: {{ :en/ToSource() }}> method. These objects are: {{page("/en-US/docs/ToSource")}}
n95    <h3 id="Examples" name="Examples">n97    <h2 id="Examples" name="Examples">
nn99    </h2>
100    <h3 id="Example:_Using_toSource" name="Example:_Using_toSourc
 >e">
101      Example: Using <code>toSource</code>
n98    <h4 id="Example:_Using_toSource" name="Example:_Using_toSourcn
>e"> 
99      Example: Using <code>toSource</code>
100    </h4>
n104    <pre class="eval">n106    <pre class="brush:js">
n106   this.name=name;n108   this.name = name;
107   this.breed=breed;109   this.breed = breed;
108   this.color=color;110   this.color = color;
109   this.sex=sex;111   this.sex = sex;
n117    <pre class="eval">n119    <pre class="brush:js">
n123    <pre class="eval">n125    <pre class="brush:js">
124({name:"Gabby", breed:"Lab", color:"chocolate", sex:"girl"})126\({name:"Gabby", breed:"Lab", color:"chocolate", sex:"girl"})
n126    <h3 id="See_Also" name="See_Also">n128    <h2 id="See_Also" name="See_Also">
t128    </h3>t130    </h2>
129    <p>131    <ul>
132      <li>
133        <a href="/en-US/docs/JavaScript/Reference/Global_Objects/
 >Boolean/toSource" title="JavaScript/Reference/Global_Objects/Bool
 >ean/toSource">Boolean.toSource</a> {{Non-standard_inline()}}
134      </li>
135      <li>
130      <a href="/en/JavaScript/Reference/Global_Objects/Object/toS136        <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">toString</a>>t/toString">Object.toString</a>
131    </p>
132    <div class="noinclude">
133      <p>
134        {{ languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScri
>pt_1.5_Core/Objets_globaux/Object/toSource", "ja": "ja/Core_JavaS 
>cript_1.5_Reference/Global_Objects/Object/toSource", "pl": "pl/Do 
>kumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/Object/toSource" }  
>) }} 
135      </p>137      </li>
136    </div>138    </ul><!-- languages({
139"fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Objets_globa
 >ux/Object/toSource",
140"ja": "ja/Core_JavaScript_1.5_Reference/Global_Objects/Object/toS
 >ource",
141"pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/Object/
 >toSource"}) -->

Back to History