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 line
const removedFromArray = myArray.shift();
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 OPR/100.0.0.0

Challenge: Basic JavaScript - Manipulate Arrays With shift Method

Link to the challenge:

So when I am using .shift() element it is giving out the first element of myArray but the problem is that it is printing out [ ‘John’, 23 ]
instead of [ “John”, 23 ] same problem happened in .pop()

You changed the variable name from

removedFromMyArray

to

removedFromArray
1 Like

can anyone help me in javascript and vue.js

Please open your own thread and make sure your question is not so vague. If you need help with code we have to see the code.

I changed it to removedFromMyArray but yet it is printing the output [‘John’, 23] instead of [“John” ,23]

That has nothing to do with your code not passing the challenge. The reason you are not passing the challenge is that you change the variable name.

The code responsible for running and logging the code is just transforming the quotes, again it has nothing to do with the challenge. If you just log console.log(["test"]) it will print console.log(['test']) again It is simply an “artifact” of the environment in which the code is running.

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