Basic JavaScript - Manipulate Arrays With shift Method

Tell us what’s happening:
Describe your issue in detail here.

The code is fine, I think it’s just the tests that are failing b/c the array string uses single quotes instead of double quotes.

Your code so far

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

// Only change code below this line
console.log(myArray);

let removedFromArray = myArray.shift();

//Lesson fails b/c of single quotes?? lame!
console.log(myArray);

console.log(removedFromArray);

Your browser information:

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

Challenge: Basic JavaScript - Manipulate Arrays With shift Method

Link to the challenge:

This should be removedFromMyArray.

Always use copy/paste if available. It will spare you from typos like this.

Your variable needs to be named removedFromMyArray

1 Like

Just as an aside, it seems odd you reached your conclusion without testing it. If you had tested it you would have known that replacing the quote types wouldn’t have made the challenge pass.

Always test your assumptions about your code, they will often be wrong.

1 Like

Yep, good point. Thanks for the reply.

Note - its usually a bad idea to ignore these comments here. Changing between single/double quotes is benign, but other changes might not be so benign.

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