Manipulate Arrays With shift()

Manipulate Arrays With shift()


I entered the code below,but seems to be incorrect,can anyone show me the correct way?thanks

Your code so far

// Example
var ourArray = ["Stimpson", "J", ["cat"]];
removedFromOurArray = ourArray.shift();
// removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].

// Setup
var myArray = [["John", 23], ["dog", 3]];

// Only change code below this line.
var removedFromMyArray = myArray.shift();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


Seems to be a bug in the tests. If you add var in front of removedFromOurArray, it will formally declare it and pass tests.


thank you for your reply. Problem solved:)


var removedFromMyArray = myArray.shift();
removedFromMyArray = myArray.shift();

both don’t work for me, anyone got any suggestions? Is it still bugged?


Not working for me either :frowning:


Have you tried putting a var in front of removedFromOurArray?


I did, but it won’t let me pass.

EDIT: read your post wrong. Tried it, and that works :slight_smile: That must be something to look at though, I was only looking at my code below the line.