Tell us what’s happening:
There seems to be a problem here, please correct me if I am wrong.
When using myArray.unshift([“Paul”, 35]), the outcome should be [[“Paul”, 35], [“John”, 23],[“dog”, 3]] as the unshift method add to array to the beginning of myArray but the expected outcome should be :
myArray
should now have [[“Paul”, 35], [“dog”, 3]].
I have changed myArray[0] to get to the outcome and did not require unshift at all?
Your code so far
// Setup
var myArray = [["John", 23], ["dog", 3]];
myArray[0] = ["Paul", 35];
// Only change code below this line
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS armv7l 12105.75.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.102 Safari/537.36
.
Challenge: Manipulate Arrays With unshift()
Link to the challenge: