how to read an array in javascript in html5

Solutions on MaxInterview for how to read an array in javascript in html5 by the best coders in the world

showing results for - "how to read an array in javascript in html5"
Alessia
26 Jan 2017
1<body>
2  <h1>Creating Arrays</h1>
3  <h2>Regular:</h2>
4  <script language="JavaScript">
5    // Create the array.
6    var Colors = new Array();
7    // Fill the array with data.
8    Colors[0] = "Blue";
9    Colors[1] = "Green";
10    Colors[2] = "Purple";
11    // Display the content onscreen.
12    document.write(Colors);
13  </script>
14  <h2>Condensed:</h2>
15  <script language="JavaScript">
16    // Create the array and fill it with data.
17    var Colors = new Array("Blue", "Green", "Purple");
18    // Display the content onscreen.
19    document.write(Colors);
20  </script>
21  <h2>Literal:</h2>
22  <script language="JavaScript">
23    // Create the array and fill it with data.
24    var Colors = ["Blue", "Green", "Purple"];
25    // Display the content onscreen.
26    document.write(Colors);
27  </script>
28</body>