Array helpers for Javascript

I would like to represent you some useful Javascript helper functions for manipulating data.

.forEach()

forEach() calls a provided callback function once for each element in an array in ascending order.

Syntax:

Example:

forEach() function

.filter()

flter() creates a new array with all elements that pass the test implemented by the provided function.

Syntax:

Example:

filter() function

.find()

find() returns the value of the first element in the provided array that satisfies the provided condition.

Syntax:

Example:

find() function

.map()

map() creates a new array with all elements that pass the test implemented by the provided function.

Syntax:

Example:

map() function

.reduce()

reduce() executes a reducer dunction (that you provide) on each element of the array, resulting in single output value.

Syntax:

Example:

reduce() function

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store