Basic JavaScript - Stand in Line *Please Help*

I am confused with where the information comes from in this challenge:
This is what I have so far and added a screenshot, perhaps a lesson link to guide me or what I am missing, feel like its simple or something someone can guide me to the answer; just heads up DO NOT COME from a technical background, more business and art experience. Use lamens terms or articles/videos to understand solutions too :blush:

Your code so far

function nextInLine(arr, item) {
  // Only change code below this line
  return item;
  // Only change code above this line

// Setup
let testArr = [1, 2, 3, 4, 5];

// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));

Your browser information:

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

Challenge: Basic JavaScript - Stand in Line

Link to the challenge:

This line removes something from the array but you don’t put that removed item anywhere, so it disappears instead of being returned from your function.

1 Like

Hmmm if I am getting it correctly remove that bit. I will try it out. I thought it just replaced the certain element instead of remove?

It’s giving me the same thing, is there an article or video to understand this because its becoming a riddle and been on this problem for a couple of days and moved unto other parts of the chapters, this one still incomplete :disappointed_relieved:

You need to use ‘.shift()’, but you aren’t using the item that is shifted out of the array

1 Like
  • as jeremy pointed out its this gives you something back, you need to make use of that in that function
  • if you need some reading to do on this “array method” then i would say this article from mdn might be useful to you, happy reading :slight_smile: Array.prototype.shift() - JavaScript | MDN

by just looking at the answers. I think everyone is holding out giving you the answer. So that you can learn by yourself. Which is awesome. Or did you eventually get the answer ? :grinning:

@flowOver Oh I know that they are with holding the answer, very very common in this industry of programming.

As for the links, @JeremyLT & @bappyasif , thank you!! I will look them over and haven’t gone over yet; just kept moving until I got to it again. Will be looking it over tonight! Thank you for the article! :blush:


It’s not that we are “holding out” so much as we are trying not to take away from you the process of figuring it out. That “figuring it out” process is a really big part of programming.


oh no ! i know its no in bad faith… its actually all love :heart_eyes: !!! how are we going to learn if we are given all the answers. ?? :rofl:

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