DevAcademy
LearnJavaScriptJavaScript Array Methods
IntermediateJavaScript

JavaScript Array Methods

Learn what array methods are, why they are useful, and explore the most commonly used methods in JavaScript.

Reading Time

12 min

Lesson

Lesson 16 of 48

What are Array Methods?

Array methods are built-in JavaScript functions that allow you to manipulate, search, transform, iterate, and sort arrays efficiently. Instead of writing complex loops, you can use array methods to perform common operations with cleaner and more readable code.

Example

Try it yourself — edit and run

Console Output

Click “Run” to see the console output here.

Why Use Array Methods?

Array methods reduce the amount of code you need to write, improve readability, make your code easier to maintain, and are highly optimized by JavaScript engines.

Benefits

  • Cleaner and shorter code
  • Easy to read and maintain
  • Avoid writing unnecessary loops
  • Perform operations efficiently
  • Work well with functional programming

Categories of Array Methods

CategoryExamples
Adding & Removingpush(), pop(), shift(), unshift(), splice()
Searchingincludes(), indexOf(), find(), findIndex()
IterationforEach()
Transformationmap(), filter(), reduce(), flatMap()
Sortingsort(), reverse(), toSorted()
Extractionslice(), concat()
Conversionjoin(), toString()
Modern Methodsat(), flat(), with(), toReversed()

Tip

Most modern JavaScript applications heavily use methods like map(), filter(), reduce(), find(), and forEach(). Mastering these methods will make your code much cleaner.

Important

Some array methods modify the original array (push, pop, splice, sort), while others return a new array (map, filter, slice, concat). Knowing the difference is essential.

What You Will Learn Next

In the following lessons, we will explore every category of array methods in detail with practical examples, interview questions, and coding exercises.

Interview Questions

Quick Quiz

1. Which method adds an element to the end of an array?

2. Which method returns a new array?

3. Which method checks whether an element exists?