Basic JavaScript - Manipulate Arrays With pop()

Tell us what’s happening:
Describe your issue in detail here.
im not really understanding where im going wrong in this. can i get a hint?

Your code so far

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

// Only change code below this line
const removedFromArray = myArray.pop();
console.log(removedFromArray);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Manipulate Arrays With pop()

Link to the challenge:

Maybe you should also print what’s inside the original array. Also, the tests say:

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

And, your code doesn’t conform to the test description.

I think due to variable name difference it is not working try removedFromMyArray

1 Like

Follow the directions of the exercise. They are telling you exactly what to do. Try using the Example they give you but incorporate the directions they are giving you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.