Manipulate Arrays With unshift() code seems right?

Manipulate Arrays With unshift() code seems right?
0

#1

Tell us what’s happening:

Can’t figure out what’s wrong with the code. Someone please help? I love how their example only has a string to unshift but the problem has a second array :confused:.

Thanks in advance,

J

Your code so far


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

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift/


#2

This is kinda the point, doesn’t make any difference if it’s a string or an array (or a number, or a boolean, etc), it’s just a value that you add using unshift. Afaics your code is fine though, if I’m right on that possibly just try clearing cache and resubmitting the test?


#3

Your code passes the tests for me.