What is array toSource of JavaScript

In this article, i am going to explain about JavaScript toSource method.
  • 2488

Array  toSource method of JavaScript

The JavaScript toSource method returns one string representing the toSource of the array object.

Syntax of toSource method


It has no parameter.

Return value of  toSource method

toSource method returns a string representing the source code of the array.

Example of toSource method

<!DOCTYPE html>
<title>JavaScript Array toSourceome Method</title>
<script type="text/javascript">
   numbers = new Array(1,2,3);
    colors = new Array("Blue","Green","Red",numbers);
    aString = colors.toSource();



["Blue", "Green", "Red", [3, 6, 7]]

Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.