Basic JavaScript - Manipulate Arrays With pop()

Tell us what’s happening:
Describe your issue in detail here.
I am already use pop() on myArray but code is not passing and give the error of pop in myArray

Your code so far

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

// Only change code below this line
const removedFromMyArray=myArray[1];

Your browser information:

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

Challenge: Basic JavaScript - Manipulate Arrays With pop()

Link to the challenge:

Why this piece?

Due to mentioned test:

  • removedFromMyArray should only contain ["cat", 2].

But why are you doing it that way?

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

kindly give one example

See the example given in the challenge below:

const threeArr = [1, 4, 6];
const oneDown = threeArr.pop();

here removedFrommyArray is not used .how i use it

I am not going to write the answer for you. That doesn’t help you at all.

Do you know what this line is doing in the example?

it pop out element from array

And…? That is not all that is happening on that line

May pop the last element from array

Right… but that is not everything that is happening on that line. What else is happening on that line?

This pops the element off, but what about this half of the line:

constant contain unchanged value but i dont know about oneDown meaning

Do you know what an = does?

You may be rushing through the curriculum too quickly if you don’t know what the = does

= is used to assign any value to variable

Right, so what is happening on this entire line? The last element of the array threeArr is being poped off, and then…?

Then this is our console output:
[“John”, 23]

That line does not generate console output.

The challenge says:

We can store this popped off value by assigning it to a variable.

Can you see that this line does that?

No, this line might not

The line might not what? I don’t understand what you said.