Basic JavaScript - Manipulate Arrays With pop MethodYou should use pop() on myArray. removedFromMyArray should only contain ["cat", 2]

Tell us what’s happening:
Describe your issue in detail here. You should use

pop()

on

myArray

.

removedFromMyArray

should only contain

["cat", 2]

Your code so far

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

// Only change code below this line

const removeFromMyArray = myArray.pop(["cat, 2"]);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Manipulate Arrays With pop Method

Link to the challenge:

you have change your myArray.pop(["cat, 2"]); from your code and change it to myArray.pop();
because pop methods removes last element from array.

i have tried that a few times, i wonder how !

The const is named removedFromMyArray, not as you have written.
Add the console.log(myArray) and console.log( removedFromMyArray) and you will see the result in the console.

As @ Viv01 said, change the expression in myArray.pop(); (don’t add anything within parentheses).

thanks guys, i got it…very helpful, after taking a break

1 Like

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