var ourArray = [1,2,3];
var removedFromOurArray = ourArray.pop();
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line.
var removedFromMyArray=myArray[1];
myArray.pop();
its just showing this
myArray should only contain [["John", 23]] .
You should use pop() on myArray .
removedFromMyArray should only contain ["cat", 2] .
pop() returns the removed item, so you gotta hand it over to where it should be stored, not exactly but in language somewhat like this:
the_removed_portion EQUALS the full array.pop()
Your solution works in terms of values, but it is actually a bit cheating. What if your array has an unknown number of entries and you want to remove the last item? Then myArray[1] wouldnโt work.
Iโve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the โpreformatted textโ tool in the editor (</>) to add backticks around text.