freeCodeCamp Challenge Guide: Manipulate Arrays With unshift

freeCodeCamp Challenge Guide: Manipulate Arrays With unshift
0

#1

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”,35]);

But it is not working…Why???


#2

This does not work, and I cannot figure it out


#3

Make sure that you are unshifting an array and not each item, example:

var myArray = ['Hello', 'World']; myArray.unshift(['More stuff', 60]); console.log(myArray); // [['More stuff', 60], 'Hello', 'World']


#5

this worked for me myArray.unshift([“Paul”,35]);


#6

i am stuck in this one. it says to append [“Paul”,35] in the beginning.
below it says myArray should now have [[“Paul”, 35], [“dog”, 3]] so we have to use .shift() as well? to remove [“John”, 23]?

any one?