Bug on Manipulate arrays with .shift()?

Bug on Manipulate arrays with .shift()?


here is my code:

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

this does not return as expected, instead throwing an error “assignment to undeclared variable removedFromOurArray” this has me absolutely stumped and i cant seem to find a suitable workaround, so any help is appreciated.


figured it out, simply add var to the second line, just before “removedFromOurArray”.
so the line will read “var removedFromOurArray = ourArray.shift();”

this is a bit of an oversight from the developers that may confuse newcomers who are following the specific instructions to “only change code below this line”.


I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


Thank you for posting this, I was really stumped on this challenge as well.


Good eye @Aidanh15 !

I submitted a bug fix. I think I did that the right way. We’ll see.