You might want to review the section on how push works here.
And you don’t want to remove everything from the array, just the first item. And you want to return that removed item from the function. You should end up with [2,3,4,5,6] in the console logs at the bottom.
DearT.:
1.i also can’t understand your meaning :“is addding 2 to the end of the array. You are asked to add item and not 2.” ? At the “arr.push(2)” the “2” inside is 2 items or a number? if is items its number are "6"and “7”? if is number the queue is:[1,2,3,4,5,2]?
2. a.nextInLine([], 5) should return a number.
b.nextInLine([], 1) should return 1
c.nextInLine([2], 1) should return 2
d.nextInLine([5,6,7,8,9], 1) should return 5
e.After nextInLine(testArr, 10), testArr[4] should be 10
What are the" a-e" 's meaning?
the function has two parameters, arr and item. arr will be an array, and item will be a number. You need to use both of them in the function for it to work properly. They are asking you to add the parameter item to the end of arr, then remove the first element from arr and return that removed element. If you use arr.push(2) the function will always add the number 2 to arr, which makes the function not very flexible.