Basic JavaScript - Manipulate Arrays With pop()

Tell us what’s happening:
Describe your issue in detail here.
The only part it says Im wrong on is that i should use pop( ) on myArray. ? Am I not? and can you please explain so I could understand.
Your code so far

var ourArray = [1,2,3];
var removedFromArray = ourArray .pop()
//removedFromOurArraynowequals3,andourArraynowequals[1.2]
// Setup
const myArray = [["John", 23], ["cat", 2]];
var removedFromMyArray = myArray[1]; 
var removedmyArray = myArray .pop();

// Only change code below this line

Your browser information:

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

Challenge: Basic JavaScript - Manipulate Arrays With pop()

Link to the challenge:

@jessie3 there are syntax errors on your solution.

image

image

You can refer to this documentation to resolve it.

1 Like

var removedFromMyArray = myArray.pop();

The above single line of code is what you have in your solution except , you have the variable name “removedmyArray” instead it should be “removedFromMyArray” to pass this task.

.pop() will be used to pop off the value from myArray and assign it to removedFromMyArray variable.

Hope this helps!

1 Like

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