0Pricing
Javascript for Kids · Lesson

Adding and Removing Items

Use push and pop to change your list.

Adding and Removing Items is a free Javascript for Kids lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Adding and Removing 📥📤

Hi, list keeper! 🌟 We can ADD and REMOVE items from a list!

We use .push() to add and .pop() to remove. 🪄

let bag = ["apple"]
bag.push("banana")
console.log(bag)

Push to Add 📥

.push() adds a new item to the END of the list!

Like dropping a new treasure into the chest. 💎

let chest = ["gold"]
chest.push("gem")
console.log(chest)

Pushing Many Things 🎁

You can push more than once to add several items!

Watch the list grow. 📈

let bag = []
bag.push("candy")
bag.push("cookie")
bag.push("cake")
console.log(bag)

Pop to Remove 📤

.pop() removes the LAST item from the list!

Like taking the top treasure off. ✋

let chest = ["gold", "gem", "crown"]
chest.pop()
console.log(chest)

Push then Pop 🔄

We can add and remove in the same program!

Add a banana, then take it back. 🍌

let bag = ["apple"]
bag.push("banana")
console.log(bag)
bag.pop()
console.log(bag)

The List Grows 📈

Each push makes the list longer. The .length goes up!

More items, bigger length. 🔢

let bag = ["a"]
console.log(bag.length)
bag.push("b")
console.log(bag.length)

The List Shrinks 📉

Each pop makes the list shorter. The .length goes down!

Fewer items, smaller length. 🔽

let bag = ["a", "b", "c"]
console.log(bag.length)
bag.pop()
console.log(bag.length)

Filling a Basket 🧺

Let us fill an empty basket with fruit!

Push, push, push! 🍎🍌🍇

let basket = []
basket.push("apple")
basket.push("banana")
basket.push("grape")
console.log("Basket:", basket)

Eating a Snack 🍪

Let us pop a snack off the list and eat it!

One less snack now. 😋

let snacks = ["chips", "cookie", "candy"]
snacks.pop()
console.log("Snacks left:", snacks)

Adding Friends 🧒

A new friend joined the team! Push them onto the list.

Welcome to the team! 🤝

let team = ["Sam", "Lily"]
team.push("Max")
console.log("Team now:", team)

Your Turn to Add 🧒

Push your favorite item onto the list and pop one off!

You are the list boss. 👑

let toys = ["ball", "kite"]
toys.push("yoyo")
console.log(toys)
toys.pop()
console.log(toys)

Quick Check ✅

List question! You can solve it! 📋

List Keeper! 🏆

Super! 🎉 Today you learned:

  • .push() adds an item to the end
  • .pop() removes the last item
  • The list grows and shrinks!

You are a list keeper! ⭐

let win = []
win.push("I can add and remove!")
console.log(win)

Frequently asked questions

Is the “Adding and Removing Items” lesson free?

Yes — the full text of “Adding and Removing Items” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Adding and Removing Items”?

Use push and pop to change your list. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Javascript for Kids?

No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Adding and Removing Items” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Javascript for Kids lesson?

Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is an Array?
  2. Getting Items by Number
  3. Adding and Removing Items
  4. Looping Through a List
← Back to Javascript for Kids