<html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- var myarray = new Array(5); myarray[0] = 5 myarray[1] = 8 myarray[2] = 10 myarray[3] = 18 myarray[4] = 180 for (x in myarray) { myarray[x] = ++myarray[x]; } document.write(myarray); document.write('<br>'); document.write(x); // --> </script> </head> <body> </body> </html>
11.5.Array Loop | ||||
11.5.1. | Use for loop to initialize an array | |||
11.5.2. | Output all array element with document.write | |||
11.5.3. | Use document.write to output the array content | |||
11.5.4. | Use for each loop to change the array element value | |||
11.5.5. | Array Iteration |