Needed help on a doubt

/*In the following example why the second line is important?

Your code so far


// Setup
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
myArray.unshift(["Paul", 35]);

Your browser information:

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

Challenge: Manipulate Arrays With unshift()

Link to the challenge:

Hi @chauhannandini234 ,

The second line ‘myArray.shift();’ will remove the first item in the array i.e [“John”, 23]

It is the requirement of the test to remove the first item and replace it with [“Paul”, 35]

Hope this makes sense.

1 Like

Thanks for your help. I got it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.