Array.prototype.toSource()

非标准
该特性是非标准的,请尽量不要在生产环境中使用它!

概述

返回一个字符串,代表该数组的源代码.

语法

array.toSource()

参数

描述

在调试时,你可以使用toSource方法来查看一个数组的内容.

例子

例子: 查看数组的源码

var alpha = new Array("a", "b", "c");

alpha.toSource();   //返回["a", "b", "c"]

浏览器兼容性

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
toSource
Non-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 74
Notes
No support 1 — 74
Notes
Notes Starting in Firefox 74, toSource() is no longer available for use by web content. It is still allowed for internal and privileged code.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs 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.
See implementation notes.
See implementation notes.

相关链接