each var arr = [1 , 3 , 5 , 7 , 9]; /* 第一个参数:遍历到的元素 第二个参数:当前遍历到的元素 注意点: 原生的forEach方法只能遍历到数组,不能遍历为数组 */ arr.forEach(function(value , index){ console.log(index,value); }) //第一个参数遍历到的索引, //第二个参数遍历到的元素 //注意点: //jQuery的each方法是可以遍历伪数组的 $.each(arr ,function(index,value){ console.log(index,value); })