Basic JavaScript - Stand in Line

Tell us what’s happening:

my function is running properly to complete the level but I did not get one process inside the function of testArr=arr.push(item); line . That how does function know I’m trying to add 6 at the end of array’s item. Is it adding 1 in the last item automatically or I did it wrongly. Even my level is going to be complete but I’m not satisfied with that.

Please help me to clear my problem.

Your code so far

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

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

// Display code

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 Information:

Basic JavaScript - Stand in Line

Look at the tests to see what’s called. You can check those in your console like this:

console.log(nextInLine([2], 1));
console.log(nextInLine([5,6,7,8,9], 1))

In your code you never actually call or test your function. It needs the second argument, the element to add.

1 Like