示例:
<body>
[1, 2, 3, 4, 5, 6]
<SCript>
var arr = [1, 2, 3, 4, 5, 6];
arr.forEach(function (value, index, arr) {
console.log('值' + value, '索引' + index, arr);
})
</SCript>
</body>
语法:forEach(function(value,index,arr){
value:数组的值
index:索引
arr:数组本身
}
)
console.log

还没有评论,来说两句吧...