JavaScript Array 遍历数组


0.array.some(function(currentValue,index,arr),thisValue) 返回值:ture/false (所有元素不符合条件才为false)

1.array.every(function(currentValue,index,arr), thisValue) 返回值:ture/false (所有元素符合条件才为true)

2.array.filter(function(currentValue,index,arr), thisValue) 返回值:array[] 需return

3.array.find(function(currentValue, index, arr),thisValue) 返回值:array[value]

4.array.findIndex(function(currentValue, index, arr), thisValue) 返回值:index

5.array.forEach(function(currentValue, index, arr), thisValue) 返回值: 没有        (数组元素执行函数体内的操作)

6.array.map(function(currentValue,index,arr), thisValue) 返回值:array[] 需return    (数组元素执行函数体内的操作)

7.array.reduce(function(total, currentValue, currentIndex, arr), initialValue)(累加器) 返回值:value

猜你喜欢

转载自www.cnblogs.com/NExt-O/p/10320021.html