# Stand in line question

**URL:** <https://forum.freecodecamp.org/t/stand-in-line-question/75547>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [January 11, 2017, 7:40pm UTC](https://forum.freecodecamp.org/t/stand-in-line-question/75547 "2017-01-11T19:40:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baconbyts](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@baconbyts](https://forum.freecodecamp.org/u/baconbyts)\
**Post date:** [January 11, 2017, 7:40pm UTC](https://forum.freecodecamp.org/t/stand-in-line-question/75547/1 "2017-01-11T19:40:32Z")

</div>

here is what it gives.

```auto
function nextInLine(arr, item) {
  // Your code here
  
  return item; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

```

I did figure out the answer i’m just wondering why if I use

```auto
function nextInLine(arr, item) {
  // Your code here
  
  var remo=arr.shift();
  arr=arr.push(item);
[spoiler] 
 //arr.push(item);
  //return arr.shift();
[spoiler]  
return remo; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

```

it doesn’t pass and if i put the shift after the push i get TypeError: arr.shift is not a function the only difference to me is i’m trying to store the value before returning it.

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 11, 2017, 8:03pm UTC](https://forum.freecodecamp.org/t/stand-in-line-question/75547/2 "2017-01-11T20:03:01Z")

</div>

I cleaned up your code.  
You need to use triple backticks to post code to the forum.  
See [this post for details](http://forum.freecodecamp.com/t/forum-code-formatting/25574).

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 18, 2021, 8:23am UTC](https://forum.freecodecamp.org/t/stand-in-line-question/75547/3 "2021-01-18T08:23:19Z")

</div>

Closed on January 18, 2021, 8:23am UTC


