Manipulate Arrays With unshift - problem

Tell us what’s happening:

what is the problem?

Your code so far

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

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

// Only change code below this line.
var myArray = [["John", 23], ["dog", 3]];
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36```.

**Link to the challenge:**

This is a working solution, see below for more details:

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

// Only change code below this line.


Hello leoigel,

the first mistake you made is in the setup section as you are not supposed to change code there :grin: Challenge usually have a // Only change code below this line. comment which tells you where to write your code.

Second mistake is with myArray.shift() since this method doesn’t accept any argument (but you inserted ["Paul",35]). The shift method knows exactly that you want to delete the first element in the array so you don’t have to declare it. Also, you asked to shift an element which is not in the array. For more details about .shift():

In the second part of your code, you also declared and initialised var myArray a second time: this operation overwrites the previous var myArray (ie ["dog", 3] after you shifted the first element).

At this point if you use unshift on the new array you declared, Javascript won’t take the shift operation into account. The final result would be:

[["Paul",35], ["John", 23], ["dog", 3]]

which is not what you are looking for.