Does anyone have any more hints for "Stand in Line?" I'm currently stuck

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

Hello everyone! I’m doing the Stand in Line Challenge and I’m currently stuck. I’m at the part where you have to make certain numbers return, and I thought I understood how returns work. But I don’t think i see the full picture. I read the little hint section and I think i see what it’s trying to say, but at the same time i don’t lol
I was seeing if someone has any tips to put me in the right direction. I feel like I know what to do, but I may be misreading the directions or something.

The code below is pretty much what I have so far, so please let me know of any helpful advice for this challenge. Thank you
Your code so far


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

item = 5;
arr.shift();
return item;
// Only change code above this line


}

// Setup
var 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/93.0.4577.82 Safari/537.36 Edg/93.0.961.52

Challenge: Stand in Line

Link to the challenge:

two things:
the function has parameters that make it reusable for any possible i out, if you overwrite one of them, the function is no more reusable, as it works only for a limited set of situations

also, you have learned that shift changes something but also retuens something. Do you remember what it changes and what it returns?

(ok, three things)
last but not least, you need to add something at the end of one array. Try to remember what you can use for that.

2 Likes

I DID IT. THANKS MAN. THIS TOOK HOURS lol. I saw a previous post from a guy called ChadKreutzer, that gave an example. And you and him helped a ton

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