3 common array functions that every JavaScript rookie should master.
Overwhelmed by all of the Array functions? Let’s fix that!
The Array object in JavaScript has dozens of functions. 33 of them last time I counted.
And snorkeling your way through every last one… err… not very romantic.
So let’s master the most commonly used functions. And save the others for another time.

Array.filter()
The filter function is used to get rid of any elements in an array that you don’t want.
A simple example — remove all odd numbers from an array.
You will notice that inside of the filter function we specify a test to make sure that the element is even. Every element that is even gets added to the new numbers array.
Array.reduce()
The reduce functions calls a reducer (that you provide) on every element in the array and reduces the output to a single value.
Say we want to find the total sum of an array of numbers. The reduce function is the best way to do it.
The reduce function accepts multiple arguments. In this example, we used the first two which are:
- The accumulated value.
- The current element being processed in the array.
Array.map()
The map function creates a new array by calling a function on every element in the old array.
For example, we want to double the value of every element in an array.
You can use map to call a provided function on every element in an array.
And there you go! The 3 commonly used Array functions that every JavaScript-wanna-be-wizard should master.
Want to learn how to become a better JavaScript developer in less time? Check out this article that you probably missed.
Liked this article? Please give it a hearty 👏— thank-you!