[HtmlCssJs] 2025-05-03 圈点572
摘要:js循环遍历数组方法
js循环遍历数组方法:
for(i = 0; i < arr.length; i++) {}
for (var value of myArray) {
console.log(value);
}
var arr = [ 1, 2, 3, 4, 5, 6 ];
arr.forEach((item,index,array)=>{
//value数组中的当前项, index当前项的索引,无返回值
})
arr.map(function(value,index,array){
return true;
})
console.log( arr.every( function( item, index, array ){
return item > 3;
}));