title | slug | original_slug |
---|---|---|
Array.prototype.toSource() |
conflicting/Web/JavaScript/Reference/Global_Objects/Array/toString |
Web/JavaScript/Reference/Global_Objects/Array/toSource |
{{JSRef}} {{non-standard_header}}
El método toSource()
devuelve un string representando el código fuente de un arreglo.
arr.toSource()
Un string representando el código fuente del arreglo.
El método toSource
retorna los siguientes valores:
-
Para el objeto global {{jsxref("Array")}},
toSource
devuelve el siguiente string indicando que el código fuente no está disponible:function Array() { [native code] }
-
Para instancias de {{jsxref("Array")}},
toSource
devuelve un string representando el código fuente.
Este método suele ser llamado internamente por JavaScript y no explícitamente en código. Puede usar toSource
mientras depura para examinar el contenido de un arreglo.
Para examinar el código fuente de un arreglo:
var alpha = new Array('a', 'b', 'c');
alpha.toSource();
//devuelve ['a', 'b', 'c']
- {{jsxref("Object.prototype.toSource()")}}
- {{jsxref("Array.prototype.toString()")}}