Programming flashcards

JavaScript Array Methods

50 JavaScript array method flashcards with mutation rules, copying methods, examples, and pitfalls.

50 cards By @mazo
#javascript#arrays#methods#frontend#interview
Study this deck free Browse Programming

About this deck

This 50-card JavaScript array methods deck covers everyday transformation and search methods plus modern copying alternatives such as toSorted, toReversed, toSpliced, and with.

Each study note emphasizes the distinction developers most often forget: return value, mutation, callback behavior, or a common edge case.

50cards
JavaScript beginner to intermediatelevel
JavaScript learners, frontend developers, and technical interview candidatesaudience

What you will learn

How to study this deck

Recommended study setup

Scope

This deck focuses on Array and Array.prototype behavior. It does not cover typed arrays, iterator helper APIs, or algorithm complexity in depth.

Review notes

Array behavior and modern copying methods checked against current MDN reference on 2026-07-10.

All 50 cards in this deck

FrontBackStudy note
map()Creates a new array by transforming every item.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
filter()Creates a new array with items that pass a test.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
reduce()Accumulates array values into one result.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
forEach()Runs a function for each item; returns undefined.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
find()Returns the first item that matches a condition.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
findIndex()Returns the index of the first matching item, or -1.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
some()Returns true if at least one item passes a test.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
every()Returns true if all items pass a test.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
includes()Checks whether an array contains a value.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
indexOf()Returns the first index of a value, or -1 if absent.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
slice()Returns a shallow copy of part of an array.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
splice()Mutates an array by adding, removing, or replacing items.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
concat()Merges arrays into a new array.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
join()Joins all items into a string with a separator.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
flat()Creates a new array with nested arrays flattened.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
flatMap()Maps each item then flattens the result one level.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
sort()Sorts an array in place, optionally with a compare function.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
reverse()Reverses the order of an array in place.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
at()Reads an item by index, including negative indexes from the end.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
fill()Fills a range of the array with a static value.Practice cue: write a one-line example and say whether the method mutates the original array before flipping.
push()Adds one or more items to the end and returns the new length.Mutates the original array.
pop()Removes and returns the last item.Mutates the original array; returns undefined when the array is empty.
shift()Removes and returns the first item.Mutates the array and reindexes the remaining items.
unshift()Adds one or more items to the start and returns the new length.Mutates the array and reindexes existing items.
Array.isArray()Returns true when the value is an Array.Prefer this over typeof, because typeof [] is "object".
Array.from()Creates an array from an iterable or array-like value.It can also map while converting: Array.from(items, mapFn).
Array.of()Creates an array from its arguments.Array.of(3) gives [3], while Array(3) creates three empty slots.
findLast()Returns the last item that matches a condition.Searches from the end without reversing the array.
findLastIndex()Returns the index of the last matching item, or -1.Use when you need the position rather than the value.
lastIndexOf()Returns the last index of a value, or -1.Uses strict equality and does not accept a predicate.
reduceRight()Reduces values from right to left into one result.Useful when evaluation order must start at the end.
keys()Returns an iterator over array indexes.Convert with [...array.keys()] when an array of indexes is needed.
values()Returns an iterator over array values.A for...of loop already iterates array values by default.
entries()Returns an iterator of [index, value] pairs.Useful with for...of destructuring: for (const [i, value] of items.entries()).
toSorted()Returns a sorted copy without changing the original array.Use a compare function for numbers: items.toSorted((a, b) => a - b).
toReversed()Returns a reversed copy without changing the original array.Copying counterpart to reverse().
toSpliced()Returns a copy with items added, removed, or replaced.Copying counterpart to splice(); the original array stays unchanged.
with()Returns a copy with one item replaced at a given index.Supports negative indexes, such as items.with(-1, value).
copyWithin()Copies part of an array to another position in the same array.Mutates the array and does not change its length.
lengthStores the number of array positions.Setting a smaller length truncates the array; setting a larger one creates empty slots.
Array spread[...items] creates a shallow array copy.Nested objects are still shared references.
Array destructuringExtracts items by position: const [first, second] = items.Use commas to skip positions and ...rest to collect remaining items.
Shallow copyA new outer array whose nested objects still reference the originals.slice(), concat(), spread, and copying array methods are shallow.
Sparse arrayAn array with empty slots rather than explicit undefined values.Array methods handle holes differently; prefer dense arrays for predictable behavior.
Array callback argumentsMost callbacks receive value, index, and the source array.Name only the parameters you need: items.map((value, index) => ...).
Numeric sort comparator(a, b) => a - b sorts numbers ascending.Without a comparator, sort() compares string representations.
Method chainingFeeds one array result into the next method.A common readable flow is filter(...).map(...).toSorted(...).
includes() versus Set.has()includes() scans an array; Set.has() suits repeated membership checks.Convert once to a Set when the same large collection is queried many times.
Mutating array methodspush, pop, shift, unshift, splice, sort, reverse, fill, and copyWithin mutate.Mutation matters in React state and other immutable-data workflows.
Why not delete items[index]?delete leaves an empty slot and keeps the same length.Use splice() to mutate or toSpliced()/filter() to create a new array.

Frequently asked questions

Does this deck include modern JavaScript array methods?

Yes. It includes findLast, findLastIndex, toSorted, toReversed, toSpliced, and with alongside established methods.

Which JavaScript array methods mutate?

The cards and notes identify mutating methods such as push, splice, sort, reverse, fill, and copyWithin.

Is this useful for interviews?

Yes for quick recall, but interview preparation should also include writing array transformations and discussing complexity.

Is the JavaScript Array Methods flashcard deck free?

Yes. You can study it free in your browser on MazoCards. Create a free account to save progress, track streaks, and sync across devices.

Git Commands Cheat Sheet

50 practical Git command flashcards for commits, branches, inspection, recovery, collaboration, and debugging history.

50 cards
Open

React Hooks Essentials

40 React 19.2 hook flashcards covering state, effects, refs, transitions, actions, external stores, common pitfalls, and when not to use a hook.

40 cards
Open

SQL Basics: Queries & Joins

50 SQL flashcards covering queries, filtering, joins, aggregation, subqueries, CTEs, windows, transactions, constraints, and query plans.

50 cards
Open

CSS Flexbox and Grid

CSS layout flashcards covering Flexbox, Grid, alignment, tracks, gaps, and responsive patterns.

41 cards
Open

Start studying JavaScript Array Methods

Study these 50 cards free, then create an account to save your progress and build a streak.