Basic JavaScript - Manipulate Arrays With pop()

i said that : this line might not store popped off value by assigning it to a variable.

Why might it not do that? That is what the code says it does

1 Like

Because code say remove this
[“cat”, 2]
form array.

I don’t understand why that would mean that you cannot save the popped off value into a variable?

pop works the exact same way for every single array.

The challenge says that this is how you pop the last item off of an array and store the popped off element into a variable. This doesn’t “maybe” work. This does work.

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

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

Now, see exact according to the given example. But the code is not pass

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

You are not using the variable removedFromMyArray

ok i worked on it and inform you when it is completed

Mod Edit: SOLUTION REMOVED

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.