Asimba
August 10, 2023, 10:20am
1
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:
Viv01
August 10, 2023, 10:34am
2
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.
Asimba
August 10, 2023, 10:40am
3
i have tried that a few times, i wonder how !
Asimba:
const removeFromMyArray
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).
Asimba
August 10, 2023, 1:07pm
5
thanks guys, i got it…very helpful, after taking a break
1 Like
system
Closed
February 9, 2024, 1:07am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.