Challenge http://www.freecodecamp.com/challenges/waypoint-manipulate-arrays-with-pop has an issue. Please describe how to reproduce it, and include links to screenshots if possible.
The comments in the code instruct to only change code below line 9. This is misleading, as the solution requires changing
var removed = myArray
to
var removed = myArray.pop()
The solution is just to move the comment up higher, I could/would do this myself, but I'm new to git and don't know how to find the file or submit the change.
agree, seemed so confusing google led me here.
Same issue. Thanks for clarifying.
confusing, should be looked into. thanks
Agreed.
Googling is definitely part of the skill. I was having a hard time interpretting the instructions at first, but with this thread, I see that with the example in the comment lines 1-5, that "numbers" is analogous to "myArray."
By adding the .pop() to "myArray" as the example in line 5 does with "numbers," it pops the last value, ["cat", 2], off the array.
yeah, i was wondering why my code didn't work. lol.
what exactly is supposed to be typed and where. I'm at a total loss.
thnx in advance for the help
Monkey
go it. just add
= myArray.pop(["cat", 2]);
to the end of varvar removedFromMyArray
that will take the last item from the myArray and move it to removedFromMyArray all in one line.
so confusing, but clever
THE CODE ANSWER
Manipulate Arrays With pop
// Example
var ourArray = [1,2,3];
var removedFromOurArray = ourArray.pop();
// removedFromOurArray now equals 3, and ourArray now equals [1,2]
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line.
var removedFromMyArray = myArray.pop();
Thanks @OgunniyiOwamamwen !
Your Solution Helped alot!
Most helpful comment
go it. just add
= myArray.pop(["cat", 2]);
to the end of varvar removedFromMyArray
that will take the last item from the myArray and move it to removedFromMyArray all in one line.
so confusing, but clever