Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Array:toSource

From MDC

Non-standard

Contents

[edit] Summary

Returns a string representing the source code of the array.

Method of Array
Implemented in: JavaScript 1.3

[edit] Syntax

array.toSource()

[edit] Parameters

None.

[edit] Description

The toSource method returns the following values:

  • For the built-in Array object, toSource returns the following string indicating that the source code is not available:
function Array() {
    [native code]
}
  • For instances of Array, toSource returns a string representing the source code.

This method is usually called internally by JavaScript and not explicitly in code. You can call toSource while debugging to examine the contents of an array.

[edit] Examples

[edit] Example: Examining the source code of an array

To examine the source code of an array:

alpha = new Array("a", "b", "c");
alpha.toSource()                    //returns ["a", "b", "c"]

[edit] See Also

toString