forEach var age=[12,45,656,48,87,789,845,47]; age.forEach(function (value) { console.log(value); }) //遍历输出值12 45 656 48 87 789 845 47 for…in和for…of var arr = [3,4,5]; for (var x in arr) { console.log(x); } //输出索引,0 1 2 for (var x of arr) { console.log(x); } //输出值,3 4 5