- for loop-the most common method
- arr.forEach (function (value, index, array) ())-traverse the array ----- map () is similar
- arr.filter (function (value, index, array) {return value> 20;})-filter array--returns a new array
- arr.some (function (val, index, arr) {return value> 20;})-Find whether there is no element that meets the condition, return Boolean value --- find the first element that meets the condition, then stop the loop- ---- every () is similar
Some methods of array iteration
Guess you like
Origin www.cnblogs.com/joeynkay/p/12735335.html
Recommended
Ranking