Jobs
Blogs
Courses
Mentorship
Partners
For Employers
e2e logo

JAVASCRIPT ARRAY METHODS (MAP, FILTER AND REDUCE FUNCTIONS)

mac

MAP:


The map() method is used for creating a new array from an existing one, applying a function to each one of the elements of the first array.

Example;

FILTER:

The filter() method takes each element in an array and it applies a conditional statement against it. If this conditional returns true, the element gets pushed to the output array. If the condition returns false, the element does not get pushed to the output array.

Example;

REDUCE:

The reduce() method reduces an array of values down to just one value. To get the output value, it runs a reducer function on each element of the array.

 Example;