非标准
该特性是非标准的,请尽量不要在生产环境中使用它!
toSource()
返回表示源代码的字符串。
语法
dateObj.toSource() Date.toSource()
返回值
表示Date
源代码的字符串
描述
toSource()
返回以下参数:
- 对于内置的
Date
对象,toSource()
返回以下字符串,表示源代码不可用:function Date() { [native code] }
- 对于
Date
的实例,toSource()
返回表示该日期源代码的字符串.
此方法通常由JavaScript内部调用,而不是在代码中显式调用。
规范
暂无标准, 在 JavaScript 1.3中实现.
浏览器兼容性
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
toSource
|
Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.