Number.prototype.toSource()

  • Revision slug: Web/JavaScript/Reference/Global_Objects/Number/toSource
  • Revision title: numObj.toSource()
  • Revision id: 481393
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{JSRef("Global_Objects", "Number")}} {{ Non-standard_header() }}

Summary

Returns a string representing the source code of the object.

Syntax

numObj.toSource();
Number.toSource();

Parameters

None.

Description

The toSource() method returns the following values:

  • For the built-in Number object, toSource() returns the following string indicating that the source code is not available:
function Number() { [native code] }
  • For instances of Number, toSource() returns a string representing the source code.

This method is usually called internally by JavaScript and not explicitly in code.

Specifications

Not part of any standard. Implemented in JavaScript 1.3.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See Also

  • {{jsxref("Global_Objects/Object/toSource", "Object.prototype.toSource()")}}

Revision Source

<div>
  {{JSRef("Global_Objects", "Number")}} {{ Non-standard_header() }}</div>
<h2 id="Summary" name="Summary">Summary</h2>
<p>Returns a string representing the source code of the object.</p>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="syntaxbox">
numObj.toSource();
Number.toSource();
</pre>
<h3 id="Parameters" name="Parameters">Parameters</h3>
<p>None.</p>
<h2 id="Description" name="Description">Description</h2>
<p>The <code>toSource()</code> method returns the following values:</p>
<!-- This shouldn't be here, but until reorganization where pages are moved to their proper places, the title of this article is ambiguous, so it can stay. After reorganization, this should be removed. -->
<ul>
  <li>For the built-in <code>Number</code> object, <code>toSource()</code> returns the following string indicating that the source code is not available:</li>
</ul>
<pre class="eval">
function Number() { [native code] }</pre>
<ul>
  <li>For instances of <code>Number</code>, <code>toSource()</code> returns a string representing the source code.</li>
</ul>
<p>This method is usually called internally by JavaScript and not explicitly in code.</p>
<h2 id="Specifications">Specifications</h2>
<p>Not part of any standard. Implemented in JavaScript 1.3.</p>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_Also" name="See_Also">See Also</h2>
<ul>
  <li>{{jsxref("Global_Objects/Object/toSource", "Object.prototype.toSource()")}}</li>
</ul>
Revert to this revision