This document discusses JavaScript array methods like forEach, map, filter, find, reduce, some, and every. It explains what each method does, such as forEach calling a callback function once per element, map creating a new array by applying a callback to each element, and reduce executing a reducer function on each element to produce a single value. It also introduces arrow functions as a more compact alternative to regular functions.
This document discusses JavaScript array methods like forEach, map, filter, find, reduce, some, and every. It explains what each method does, such as forEach calling a callback function once per element, map creating a new array by applying a callback to each element, and reduce executing a reducer function on each element to produce a single value. It also introduces arrow functions as a more compact alternative to regular functions.
Understand and use these methods: forEach map filter find reduce some every FOREACH Accepts a callback function. Calls the function once per element in the array. MAP Creates a new array with the results of calling a callback on every element in the array MAP ARROW FUNCTIONS! ARROW FUNCTIONS "syntactically compact alternative" to a regular function expression ARROW FUNCTIONS IMPLICIT RETURN All these functions do the same thing: FIND returns the value of the first element in the array that satisfies the provided testing function. FILTER Creates a new array with all elements that pass the test implemented by the provided function. EVERY tests whether all elements in the array pass the provided function. It returns a Boolean value. SOME Similar to every, but returns true if ANY of the array elements pass the test function REDUCE Executes a reducer function on each element of the array, resulting in a single value. SUMMING AN ARRAY FINDING MAX VAL INITIAL VALUE TALLYING