|
|
|
|
|
|
|
|
|
|
|
Loops
and arrays work together
|
|
|
|
• |
Declare an array and initialize elements to 4
|
|
|
var j, A = new Array(5);
|
|
|
|
for (j=0; j<5; i++) {
|
|
|
|
A[i] = 4;
|
|
|
|
}
|
|
|
|
WFI and array’s indices both start at 0
|
|
|
|
Notice what would change to have 1000
|
|
|
elements -- arrays and loops give power
|
|