← JavaScript

Arrays – Mutating Methods

Adds one or more elements to the end of an array, changing the original array.

Understanding Arrays – Mutating Methods in JavaScript

What it does: unshift() inserts the value at the beginning of the array. shift() removes and returns the array's first element. push() adds one or more elements to the end of the array. push, pop, shift, and unshift all mutate the original array. JavaScript uses push(), not add(), to add elements. pop() always removes the last element with no arguments needed. push() appends the given value to the end of the array. JavaScript arrays don't have an add() method - use push().

Common mistakes: Use push(), not add(), to add to the end of an array. Use pop(), not remove(), to remove the last element.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 11–25) and crossword (Modules 21–30) and word search (Modules 1–29) and word search (Modules 21–52).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does push() add an element to the end of an array?
YesNo
Matches
a.add(3);
↓
Wrong - use push(), not add(), to add to the end
Applying
Meanings
Term
push()
Meaning
Adds one or more elements to the end of an array, changing the original array.
Practice
let nums = [2, 3];
Testing
Gaps
nums.(4);
Check Answer
Spots
1a.add(3);
2let a = [1, 2];

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Space Turtle' badge — Speed in Zero-G, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does push() add an element to the end of an array?
A. Yes ✓
B. No
push() adds one or more elements to the end of the array.
2. Does pop() remove the first element of an array?
A. No ✓
B. Yes
pop() removes the last element, not the first.
3. Does unshift() add an element to the start of an array?
A. No
B. Yes ✓
unshift() adds elements at the beginning of the array.
4. Does shift() remove the first element of an array?
A. No
B. Yes ✓
shift() removes and returns the first element.
5. Do these methods change the original array?
A. Yes ✓
B. No
push, pop, shift, and unshift all mutate the original array.

Match the Pairs

nums.push(4) → Adds 4 to the end of the nums array
nums.pop() → Removes the last element from the nums array
Adds an element to the start of an array → nums.unshift(1)
Removes the first element from an array → nums.shift()
a.add(3); → Wrong - use push(), not add(), to add to the end
b.remove(); → Wrong - use pop(), not remove(), to remove the last element

Key Term

push()
Adds one or more elements to the end of an array, changing the original array.

Fill in the Blanks

1. nums.push(4);
Hint: Type the method that adds an element to the end of an array.
2. nums.pop();
Hint: Type the method that removes the last element of an array.
3. nums.unshift(1);
Hint: Type the method that adds an element to the start of an array.
4. let first = nums.shift();
Hint: Type the method that removes the first element of an array.
5. scores.push(90);
Hint: Type the method that adds an element to the end of an array.

Spot the Error

Question 1
A a.add(3);
B let a = [1, 2];
C console.log(a);
Line A — Use push(), not add(), to add to the end of an array.
Question 2
A let b = [1, 2, 3];
B b.remove();
C console.log(b);
Line B — Use pop(), not remove(), to remove the last element.
Question 3
A let c = [2, 3];
B console.log(c);
C c.push;
Line C — push() needs parentheses to actually call the method.
Question 4
A let d = [1, 2, 3];
B console.log(d);
C let e2 = 5;
D d.Pop();
Line D — 'pop' must be lowercase - a capital P causes an error.
Question 5
A let e = [2, 3];
B console.log(e);
C let f2 = 1;
D console.log(f2);
E e.Push(1);
Line E — 'push' must be lowercase - a capital P causes an error.

Student with a class code? Join your class →