How can i solve that problem

How can i solve that problem


Tell us what’s happening:

Your code so far

function nextInLine(testArr, item) {
  // Your code here
  var item1=nextInline([2],1);
  return item1;  // Change this line
var test= nextInline([2],1);
// 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));

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0.

Link to the challenge:


Not sure why you put code outside the function. Inside your function, you need to add the number (represented by the argument named item in your function) to testArr (the 1st argument in your function). You should use push to do that. Do not hardcode the 6 (as you were doing above). Finally, your function should return the first item in testArr. You can use shift on testArr to retrieve this value. You can simply use the return statement with the shift function to achieve this.

Try again and see if you can use what I have told you to pass this challenge.