Don't understand this topic:- Manipulate Arrays With unshift()

Tell us what’s happening:
I don’t understand how this unshift() works. I’m stuck here :frowning:
Please help me out if you can.
-Thanks in advance

Your code so far

// Example
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.

Your browser information:

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

Link to the challenge:

unshift   adds something to the start of the area
push      adds something to the end of the area
shift     removes something from the start of the area
pop       removes something from the end of the area

does this help?

The issue is that
var myArray = [ [“John”, 23], [“dog”, 3] ]; is a TWO dimensional array,
therefore, myArray[0] = [“John”, 23] and myArray[1] = [“dog”, 3]
each element of myArray is itself another array.
All these methods (functions), they do return values, in the case of shift & unshift they return the length of the new formed array. don’t get confused with:

var myArray = [ [“John”, 23], [“dog”, 3] ];
var test = myArray.unshift( ‘testvar’ );
console.log(test); // 3 (the new length of myArray)
console.log(myArray); // [ ‘testvar’, [“John”, 23], [“dog”, 3] ] (the myArray itself)

not at all :frowning_face: