Basic JavaScript - Manipulate Arrays With shift Method

This exercise as well as the pop method exercise are not functioning and the compiler does not recognize the correct answers for these two. Please fix it.
const myArray = [[“John”, 23], [“dog”, 3]];

// Only change code below this line

const removedFromArray = myArray.shift();

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

// Only change code below this line
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/117.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Manipulate Arrays With shift Method

Link to the challenge:

Theres nothing wrong with the challenge, your code is just not correct. Look at the directions again

it says " assign the “shifted off” value to a new variable, removedFromMyArray ."

And you are using the variable
“removedFromArray”

Apologies, my mistake. Basically, I had changed the name of the variable to removedFromArray dropping My, that’s all!

1 Like