Home >Web Front-end >JS Tutorial >A brief discussion on JavaScript iteration method_Basic knowledge
The five iteration methods all accept two parameters: the function to be run on each item and the scope in which to run the function (optional)
every(): Runs the given function on each item in the array. Returns true if the function returns true for each item.
Filter(): Runs the given function on each item in the array. Returns an array of items that this function will return true.
forEach(): Runs the given function on each item in the array. This function has no return value.
Map(): Runs the given function on each item in the array. Returns a function consisting of the results of each function call.
Some(): Runs the given function on each item in the array. If the function returns true for any item, then return true
The above is the entire content of this article. I hope it can give you some tips to better understand the JavaScript iteration method.