Master These 8
Essential Array
Methods
Sehrish Waheed
Filter
Creates a new array containing elements
from the original array that pass a certain
condition specified by a callback function
Sehrish Waheed
Map
The map method iterates over each element
in the array and applies a transformation
specified by a callback function.
Sehrish Waheed
FIND
find method takes a callback function as its
argument. This callback function is
executed for each element in the array and
should return true or false based on a
condition.
Sehrish Waheed
forEach
iterate over the elements of an array and
perform a specified action for each element
Sehrish Waheed
SOMe
Returns true if the callback function
returns true for at least one element in the
array. Otherwise, it returns false
Sehrish Waheed
Every
every method tests whether all elements in
the array satisfy the provided testing
function
Sehrish Waheed
Reduce
reduce method applies a function against
an accumulator and each element in an
array (from left to right) to reduce it to a
single value
Sehrish Waheed
Includes
checks if a specific value is present in an
array and returns true if the value is found,
and false otherwise. It performs a simple
equality comparison for primitive values
like numbers, strings, and booleans.
Sehrish Waheed
Save it for later