The .forEach() method executes a callback function on each of the elements in an array in order. The callback function containing a console.log(number) method will be executed 3 times, once for each element. After it will each number in the array.
The .map() method executes a callback function on each element in an array. It returns a new array made up of the return values from the callback function. The original array does not get altered, and the returned array may contain different elements than the original array.
The .reduce() method iterates through an array and returns a single value. It takes a callback function with two parameters accumulator and currentValue as arguments. On each iteration, accumulator is the value returned by the last iteration, and the currentValue is the current element. The .reduce() will sum all the elements of the array and return 100 after it is executes.
The .filter() method executes a callback function on each element in an array. The callback function for each of the elements must return either true or false . The returned array is a new array with any elements for which the callback function returns true. The array filtered will contain all the elements of the numbers array except 4 since only numbers greater than 5 are filtered out.
Array iteration methods operate on every array item. The forEach() method calls a function (a callback function) once…