Freecodecamp: Incorrect instructions on Waypoint: Manipulate Arrays With pop

Created on 17 Aug 2015  路  11Comments  路  Source: freeCodeCamp/freeCodeCamp

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()

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

All 11 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielonodje picture danielonodje  路  3Comments

Tzahile picture Tzahile  路  3Comments

robwelan picture robwelan  路  3Comments

ar5had picture ar5had  路  3Comments

MichaelLeeHobbs picture MichaelLeeHobbs  路  3Comments