Basic JavaScript - Manipulate Arrays With pop Method

Tell us what’s happening:

// Setup
const myArray = [[“John”, 23], [“cat”, 2]];

// Only change code below this line
const removeFromMyArray = myArray.pop();

I’ve ran this code on this site and in other ones and it outputs the desired result. yet it says that it is incorrect.

Your code so far

// Setup
const myArray = [["John", 23], ["cat", 2]];

// Only change code below this line
const removeFromMyArray = myArray.pop();

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36

Challenge Information:

Basic JavaScript - Manipulate Arrays With pop Method

Use the .pop() function to remove the last item from myArray and assign the popped off value to a new variable, removedFromMyArray .

small difference, but you have the wrong variable name

Hi there and welcome to our community!

Use the .pop() function to remove the last item from myArray and assign the popped off value to a new variable, removedFromMyArray .

Your variable name doesn’t quite match the requirements.

1 Like