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.

Image for post
Image for post

Array.filter()

The filter function is used to get rid of any elements in an array that you don’t want.

Remove all odd numbers from a JavaScript 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.

Reduce a Javascript Array to a single value
  1. 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.

Double the value of every element in a JavaScript Array

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