Member-only story

10 Important Array Methods In JavaScript Explained

Oliver Jumpertz
13 min readJan 15, 2022

I recently read a great article by Marko Denic about array methods. Inspired by this, I thought to myself that it might be a great opportunity to explain them thoroughly and show you what you can use them for, and how you could implement them yourselves. Without further ado, let’s get into it.

1. filter()

filter is the method whenever you want to, well, filter out values. Only want positive values? Only looking for objects that have a certain property? filter is your way to go.

The following is the signature of the filter method:

filter(function (element, index, array) {
// element is the element within the array
// index is the index of the element in the array
// array is a reference to the array filter works on
}, thisOverride);
// thisOverride is a way to override the semantical this within the callback function.
// If you set it to another object, calling this.anyThing would access anyThing within that
// object, and not the actual array.

Example Use Case

Imagine that you have an online shop. And now you want to send a discount code to all customers that live in a certain area.

const getElibigleCustomers(customers, zipCode) {
return customers.filter(
(customer) =>

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Oliver Jumpertz
Oliver Jumpertz

Written by Oliver Jumpertz

Software Engineer - Content Creator

No responses yet

Write a response