blob: 3ed14e13977827a3ab8595f52d1c3455eacdc579 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
---
title: Number.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Number/toSource
translation_of: Web/JavaScript/Reference/Global_Objects/Number/toSource
---
<div>
{{JSRef("Global_Objects", "Number")}} {{ Non-standard_header() }}</div>
<h2 id="Summary" name="Summary">概述</h2>
<p><code><strong>toSource()</strong></code> 方法返回该对象源码的字符串表示。</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox">numObj.toSource();
Number.toSource();
</pre>
<h3 id="Parameters" name="Parameters">参数</h3>
<p>无</p>
<h2 id="Description" name="Description">描述</h2>
<p><code>toSource()</code> 方法返回下列值:</p>
<ul>
<li>对于内置 <code>Number</code> 对象, <code>toSource()</code> 返回下面字符串,用来指明源码是不可见的。</li>
</ul>
<pre class="eval">function Number() { [native code] }</pre>
<ul>
<li>对于 <code>Number</code> 对象的实例,<code>toSource()</code> 返回一个表示源码的字符串。</li>
</ul>
<p>该方法通常被 JavaScript 内部调用,而不是在代码中显示调用。</p>
<h2 id="规范">规范</h2>
<p>不是任何标准的一部分。在 JavaScript 1.3 被实现。</p>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{ CompatibilityTable() }}</p>
<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</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatVersionUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Chrome for Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatVersionUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatUnknown() }}</td>
</tr>
</tbody>
</table>
</div>
<h2 id="See_Also" name="See_Also">相关链接</h2>
<ul>
<li>{{jsxref("Object.prototype.toSource()")}}</li>
</ul>
|