20160221-js-codecademy

for循环 ()内用分号;隔开

for (var i = 1; i < 6; i ++) {
        console.log(i);
}
// 1, 2, 3, 4, 5

定义数组

var junk = ["abc", "acd", 2, 4];
for (i = 0; i < junk.length; i++) {
        console.log(junk[i]);
}
// abc, acd, 2, 4

你可能感兴趣的:(20160221-js-codecademy)