Manipulate Arrays With unshift

Totally lost. Is this not the correct code? myArray.unshift(‘Paul’);

Manipulate Arrays With unshift

// Example
var ourArray = [“Stimpson”, “J”, “cat”];
ourArray.shift(); // ourArray now equals [“J”, “cat”]
ourArray.unshift(“Happy”);
// ourArray now equals [“Happy”, “J”, “cat”]

// Setup
var myArray = [[“John”, 23], [“dog”, 3]];
myArray.shift();

// Only change code below this line.

myArray.unshift(‘Paul’);

It says

Add ["Paul",35] to the beginning of the myArray variable using unshift()

You were only unshifting 'Paul'

I did that and the code still comes up wrong.

Can you post your code?

myArray.unshift(‘Paul’);
[

I got it it. Thanks.

myArray.unshift([“Paul”,35]);

2 Likes