--- title: Array.prototype.toSource() slug: Web/JavaScript/Reference/Global_Objects/Array/toSource translation_of: Web/JavaScript/Reference/Global_Objects/Array/toSource ---
{{JSRef("Global_Objects", "Array")}}{{Non-standard_header}}
返回一个字符串,代表该数组的源代码.
array.toSource()
无
在调试时,你可以使用toSource方法
来查看一个数组的内容.
var alpha = new Array("a", "b", "c"); alpha.toSource(); //返回["a", "b", "c"]
{{Compat("javascript.builtins.Array.toSource")}}