Add / Remove
push, pop, splice
Grow or shrink arrays at either end, or splice in the middle.

JavaScript arrays store ordered lists of values. Built-in methods on Array.prototype (and a few static helpers on Array) let you add, remove, search, and transform data without reinventing loops every time. This hub links to 39 method tutorials, each with syntax, try-it examples, and FAQs — plus a searchable index below.
push, pop, splice
Grow or shrink arrays at either end, or splice in the middle.
find, includes
Locate values by equality or by a predicate callback.
map, filter, flat
Build new arrays from existing ones without mutating the source.
reduce, some, every
Fold lists into one value, or test whether any/all items match.
slice, concat, with
Copy portions or return updated arrays without changing the original.
Full searchable index
Jump to any method tutorial from the category tables below.
JavaScript arrays are ordered collections for numbers, strings, objects, or mixed types. The language ships with dozens of helpers on Array.prototype so you can manipulate data declaratively—often in one readable chain instead of manual for loops.
An array method is a function you call on an array (or on the Array constructor for static helpers). Some methods mutate the original array; others return a new array or value and leave the source untouched. Knowing which is which prevents subtle bugs.
Almost every app turns lists into UI, filtered tables, or totals. Mastering a small set of array methods—map, filter, find, reduce, push—covers most day-to-day data work.
First element is arr[0]; length is always one past the last index.
push/splice/sort change in place; map/filter/slice return new data.
Non-mutating methods return arrays you can chain: filter().map().
Array.isArray(), Array.from(), and Array.of() live on the constructor.
In short: arrays hold ordered values; methods either mutate the list or return new results. Learn the difference, then browse the 39 tutorials for deep dives.
Call an instance method on an array variable, or a static helper on Array:
const fruits = ["apple", "banana", "cherry"];
fruits.push("date"); // mutates — adds to end
const upper = fruits.map(f => f.toUpperCase()); // new array
Array.isArray(fruits); // true — static helper | Category | Example methods | Purpose |
|---|---|---|
| Access & length | at(), slice() | Read elements by index |
| Add / remove | push(), pop(), splice() | Change array size |
| Search | includes(), find(), indexOf() | Locate values |
| Transform | map(), filter(), flat() | Build new arrays |
| Aggregate | reduce(), some(), every() | Summarize or test all items |
const nums = [1, 2, 3, 4, 5];
const result = nums
.filter((n) => n % 2 === 0)
.map((n) => n * 10);
// => [20, 40] | Goal | Method | Mutates? |
|---|---|---|
| Add to end | push(item) | Yes |
| Remove from end | pop() | Yes |
| Copy a portion | slice(start, end) | No |
| Transform each item | map(fn) | No |
| Keep matching items | filter(fn) | No |
| Sum to one value | reduce(fn, init) | No |
map vs filter vs forEach vs reduceAll iterate — but return values and intent differ.
new arrayTransforms every element into a result list
subset arrayKeeps only elements that pass a test
undefinedRuns side effects; does not build a new array
one valueFolds the list into a single accumulated result
Pick the method that matches the job — stack ops, UI lists, filters, or totals.
push() / pop() for last-in-first-out patterns.
push() + shift() (or a dedicated queue for large data).
map() to render UI from raw data rows.
filter() to show only matching rows.
reduce() to sum prices or build objects.
Key benefit: the right method name documents intent — prefer filter over a manual loop when you mean “keep matching items.”
A typical array of strings with zero-based indexes — try at(-1) for the last item:
Search by method name or browse by category. Every tutorial includes syntax, examples, and FAQs.
Essential methods for reading, adding, and removing elements.
| Method | Description | Tutorial |
|---|---|---|
at() | Retrieves an element at a specified index, including negative offsets from the end. | Open |
push() | Adds one or more elements to the end and returns the new length. | Open |
pop() | Removes and returns the last element, mutating the array. | Open |
shift() | Removes and returns the first element, shifting others down. | Open |
unshift() | Adds elements to the beginning and returns the new length. | Open |
slice() | Returns a shallow copy of a portion without mutating the original. | Open |
Find values and check whether elements match a condition.
| Method | Description | Tutorial |
|---|---|---|
includes() | Checks whether an array contains a value; returns true or false. | Open |
indexOf() | Returns the first index of a value, or -1 if not found. | Open |
lastIndexOf() | Returns the last index of a value, searching backward. | Open |
find() | Returns the first element that satisfies a testing function. | Open |
findIndex() | Returns the index of the first element that passes a test. | Open |
findLast() | Returns the last element that satisfies a testing function. | Open |
findLastIndex() | Returns the index of the last element that passes a test. | Open |
some() | Returns true if at least one element passes a test function. | Open |
every() | Tests whether all elements pass a callback; returns true or false. | Open |
Map, filter, flatten, and reduce data into new shapes.
| Method | Description | Tutorial |
|---|---|---|
map() | Creates a new array by transforming each element with a callback. | Open |
filter() | Creates a new array with elements that pass a test function. | Open |
flat() | Flattens nested arrays into a single-level array. | Open |
flatMap() | Maps each element then flattens the result by one level. | Open |
reduce() | Reduces the array to a single value by applying a callback left to right. | Open |
reduceRight() | Like reduce(), but processes elements from right to left. | Open |
Methods that modify the original array directly.
| Method | Description | Tutorial |
|---|---|---|
splice() | Adds, removes, or replaces elements at a given index in place. | Open |
sort() | Sorts elements in place using an optional compare function. | Open |
reverse() | Reverses element order in place and returns the same array. | Open |
fill() | Fills all or part of an array with a static value, mutating the array. | Open |
copyWithin() | Copies a sequence of elements within the array to another index in place. | Open |
Loop over elements or expose iterators.
Merge arrays or return updated copies without mutation.
Turn arrays into readable strings.
| Method | Description | Tutorial |
|---|---|---|
join() | Joins all elements into a string with an optional separator. | Open |
toString() | Returns a comma-separated string of the array elements. | Open |
toLocaleString() | Returns a locale-aware string representing the array. | Open |
valueOf() | Returns the primitive value of the array (the array itself). | Open |
Array constructor helpers — not called on an instance.
| Method | Description | Tutorial |
|---|---|---|
Array.from() | Creates an array from an iterable or array-like object. | Open |
Array.isArray() | Returns true if the value is an array, false otherwise. | Open |
Array.of() | Creates a new array from the arguments you pass in. | Open |
Five starter snippets combining common array methods. Open linked tutorials for full guides and try-it labs.
Filter, map, and chain methods for clean data pipelines.
Chain filter() and map() to transform a list in two steps.
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const evenSquares = numbers
.filter((num) => num % 2 === 0)
.map((even) => even ** 2);
console.log("Original:", numbers);
console.log("Even squares:", evenSquares); filter() keeps only even numbers. map() squares each survivor. The original numbers array is unchanged.
Mutate a stack-like array at the end.
const stack = ["first", "second"];
stack.push("third");
console.log("After push:", stack);
const removed = stack.pop();
console.log("Removed:", removed);
console.log("After pop:", stack); push() returns the new length and adds to the end. pop() removes the last element and returns it.
Find items and fold arrays into single values.
Use find() to locate an object by property value.
const users = [
{ id: 1, name: "Ada" },
{ id: 2, name: "Grace" },
{ id: 3, name: "Alan" }
];
const match = users.find((user) => user.name === "Grace");
console.log(match); find() stops at the first element where the callback returns true. If nothing matches, it returns undefined.
Fold an array of numbers into a single total.
const prices = [9.99, 14.5, 4.25, 22.0];
const total = prices.reduce((sum, price) => sum + price, 0);
console.log("Total:", total.toFixed(2)); The callback receives an accumulator and the current item. Starting from 0, each price adds to the running sum.
sort() orders elements in place; pass a compare function for numbers.
const languages = ["JavaScript", "Python", "Java", "Ruby"];
languages.sort();
console.log(languages); Default sort() converts elements to strings and compares UTF-16 code units. For numeric sort, use (a, b) => a - b.
Everyday situations where array methods keep code short and clear.
Turn data rows into components or HTML with map().
Example: product cards from an API list.
Keep matching items with filter() and includes().
Example: live search over a table.
Sum prices or counts with reduce().
Example: checkout subtotal from line items.
Treat an array as a stack with push() and pop().
Example: editor undo buffer.
Use every() / some() for form or schema checks.
Example: all fields filled before submit.
Prefer slice(), concat(), or with() in React-style state.
Example: replace one index without mutate.
Pro Tip: start at Getting Started (at, push, slice), then learn map / filter / find before tackling reduce.
Why reach for built-in array methods instead of raw loops.
filter and map document what the code does better than a generic for.
Compose transforms in one expression without temporary variables.
Iterators handle indexes for you; early-exit helpers like find stop when done.
Teams and libraries speak the same method names across projects.
Pro Tip: still use a plain for...of when you need break/continue or maximum control — methods are tools, not rules.
Small habits that keep array code clean and predictable.
filter().map() reads left to right; each step returns a new array.
constArrays are mutable objects; const arr = [] still allows push().
Use [...arr] or arr.slice() before mutating if you need a clone.
Most iterators receive (element, index, array).
Jump to any of 39 method pages from the tables above.
Pro Tip: check whether a method mutates before chaining it into a pipeline — sort() returns the same array and reorders it in place.
Mistakes that commonly break array-heavy code.
sort() Without a Compare FnNumeric arrays sort lexically: [10, 2, 1].sort() → [1, 10, 2].
→ Pass (a, b) => a - b for numbers.
Avoid splice() inside a forEach() over the same array.
→ Build a new list, or iterate a copy.
Holes skip callbacks in map() and forEach().
→ Prefer dense arrays or fill missing slots explicitly.
break in forEachYou cannot break out of forEach().
→ Use for...of, some(), or find() for early exit.
includes() uses SameValueZero; objects match by reference, not deep equality.
→ Use find() with a property check for objects.
Invoke arr.method(args) or Array.from(iterable) for static helpers.
Iterators walk indexes; some methods skip holes or stop early (find, some).
New array, boolean, single value, iterator, or mutated original—depends on the method.
Chain non-mutating methods for readable data transformations in apps and APIs.
arr.length = 0 clears the array; shrinking truncates trailing elements.Array.isArray(x) over typeof x === "object".at(), findLast(), and with() have per-page browser notes.delete. delete arr[i] leaves a hole — use splice() to remove items.Quick Takeaway: know mutate vs copy, pick the method that names your intent, and use the searchable index to open any of the 39 deep-dive tutorials.
Core methods like push(), map(), filter(), and reduce() work in every modern browser and Node.js. Newer methods (at(), findLast(), with()) have dedicated notes on their tutorial pages.
Most methods are production-safe in Chrome, Firefox, Safari, Edge, IE 9+, and all modern Node.js versions. Check individual tutorials for ES2022+ additions.
Bottom line: Safe to use core methods everywhere except very old IE8 environments. Polyfill or check individual pages for ES2022+ APIs like at() and with().
JavaScript array methods turn plain lists into powerful data tools. Start with Getting Started tutorials, then use the searchable index to explore all 39 guides.
Each method page includes syntax, examples, browser support, and FAQs. Combine non-mutating methods in chains to keep application code short and expressive.
Know mutate vs copy, pick the method that names your intent, and open any deep-dive from the index above.
Array.isArray() for type checkssort() for numbersslice() over splice() for copiessort() orders numbers correctly by defaultforEach() when you need a returned arraydelete arr[i] to remove items — use splice()Your gateway to 39 method tutorials.
Zero-based indexes
Basicspush, splice
In-placemap, filter
New datafind, includes
LookupSearch all
RefA JavaScript array stores ordered values. Methods like push(), map(), and filter() let you add, transform, and search elements without writing loops from scratch every time. Method chaining works because map(), filter(), and slice() each return a new array — so arr.filter(fn).map(fn) needs no temporary variables.
Open at() or push() from Getting Started, or search the full index above.
10 people found this page helpful