Javascript array toSource() method returns a string representing the source code of the array. This method is supported by Mozilla.
Its syntax is as follows −
array.toSource();
Here is the detail of parameters −
NA
Returns a string representing the source code of the array.
<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>
Returned string is : ["orange", "mango", "banana", "sugar"]