Foreach takes a callback function and run that callback function on each element of array one by one. If you’re not familiar with the array method .forEach(), whenever you go to iterate over an array you probably immediately think of a for loop.
The main difference between forEach and filter is that forEach just loop over the array and executes the callback but filter executes the callback and check its return value.
e.g. var array= [1,2,3,4,5,6,7,8,9,10] , filter even numbers from the array
Map like filter & foreach takes a callback and run it against every element on the array but whats makes it unique is it generate a new array based on your existing array.
e.g. Map objects to String array that only store name
Array.reduce is used when you want to process all the elements of an array to get a single value out of it. Array.Reduce takes two arguments, one is the reduce function and second is the initial value which is called as accumulator. It calls the reduce function for each element by passing the accumulator value. Reduce function process the current element and updates the accumulator value and pass it for the next iteration. At the end of the last loop, accumulator becomes the final result. So basically it takes an array and reduce the array into single value.
e.g. Given var array = [1,2,3,4,5], find total sum of all the values in array.
Array.Some is used to test for a condition. If any element in the array passes that condition, Array.Some method will return true, else false.
e.g. Given var array = [1,2,3,4,5,6,7], check array contain 5.