JavaScript中數組迭代方法(jquery)

var arr = [1,2,4,5,6]; //1.forEach(讓數組中的每一項做一件事) arr.forEach(function(item,index){     console.log(item);     //1,2,4,5,6 }); //2、map(讓數組通過某種計算產生一個新數組) var newArr = arr.map(function(item,index){     r
相關文章
相關標籤/搜索