blob: dbcae1c739b7b7bcbb91c6e1c15eb21dc0ffc826 (
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
|
---
title: Date.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Date/toSource
translation_of: Web/JavaScript/Reference/Global_Objects/Date/toSource
---
<div>{{JSRef}} {{non-standard_header}}</div>
<p><strong><code>toSource() </code></strong>返回表示源代码的字符串。</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><var>dateObj</var>.toSource()
Date.toSource()</pre>
<h3 id="返回值">返回值</h3>
<p> 表示{{jsxref("Global_Objects/Date", "Date")}} 源代码的字符串</p>
<h2 id="描述">描述</h2>
<p><code>toSource()</code> 返回以下参数:</p>
<ul>
<li>对于内置的{{jsxref("Date")}} 对象, <code>toSource()</code> 返回以下字符串,表示源代码不可用:
<pre class="brush: js">function Date() {
[native code]
}
</pre>
</li>
<li>对于{{jsxref("Date")}}的实例, <code>toSource()</code> 返回表示该日期源代码的字符串.</li>
</ul>
<p>此方法通常由JavaScript内部调用,而不是在代码中显式调用。</p>
<h2 id="规范">规范</h2>
<p>暂无标准, 在 JavaScript 1.3中实现.</p>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
<p>{{Compat("javascript.builtins.Date.toSource")}}</p>
<h2 id="相关链接">相关链接</h2>
<ul>
<li>{{jsxref("Object.prototype.toSource()")}}</li>
</ul>
|