Copyright © tutorialspoint.com
Javascript array toString() method returns a string representing the source code of the specified array and its elements.
array.toString(); |
Here is the detail of parameters:
NA
Returns a string representing the array.
<html>
<head>
<title>JavaScript Array toString Method</title>
</head>
<body>
<script type="text/javascript">
var arr = new Array("orange", "mango", "banana", "sugar");
var str = arr.toString();
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.
Copyright © tutorialspoint.com