Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Pushing Elements to an Array | Exploring Arrays
Introduction to JavaScript
Sectionย 5. Chapterย 5
single

single

bookChallenge: Pushing Elements to an Array

Swipe to show menu

Task

Swipe to start coding

You are given an array named shoppingList that contains the following elements:

Milk, Eggs, Bread

Your tasks:

  • Use the push() method to add the following elements to the array: "Butter", "Cheese".
  • Add the elements in the correct order.
  • Return the updated array.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 5. Chapterย 5
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt