nextInLine JavaScript queue excercise question

Can someone please tell me why you are calling out arr.push() and arr.shift() instead of testArr? It just doesn’t make any sense to me. The variable that is defined is testArr so it would make sense to call that out in the function, but every time I’ve tried to do so it has thrown an error, I don’t get it. Also I don’t know how to post code in this forum because I feel like that could get a little busy so if you need it the exercise is in JavaScript basics and it is called Basic JavaScript: Stand In Line.

-Thank you

don’t know what’s the code, if you posted a challenge link would be fantastic

but, anyway, is it maybe that arr is the function parameter? you should use the function parameter, instead of global variables to make the code reusable

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


1 Like