Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Javascript Array toSource() Method


previous next AddThis Social Bookmark Button


Advertisements

Description:

Javascript array toSource() method returns a string representing the source code of the array. This method is supported by Mozilla.

Syntax:

array.toSource();

Here is the detail of parameters:

  • NA

Return Value:

Returns a string representing the source code of the array.

Example:

<html>
<head>
<title>JavaScript Array toSource Method</title>
</head>
<body>
<script type="text/javascript">
var arr = new Array("orange", "mango", "banana", "sugar");

var str = arr.toSource();
document.write("Returned string is : " + str );

</script>
</body>
</html>

This will produce following result:

Returned string is : ["orange", "mango", "banana", "sugar"]

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements