Basic JavaScript - Manipulate Arrays With shift Method

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

// Setup
const myArray = [["John", 23], ["dog", 3]];

// Only change code below this
const removedFromArray=myArray.shift();

Your browser information:

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

Challenge Information:

Basic JavaScript - Manipulate Arrays With shift Method

You’re basically correct but your variable name isn’t quite right:

…assign the “shifted off” value to a new variable, removedFromMyArray .

1 Like

thanks but i don’t understand your explanation pls

1 Like

This is not the same as removedFromMyArray.

2 Likes

.shift() removes the first item in the array it is applied to.

It needs to be assigned to:
image

Happy coding

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.