You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using push and shift function, the validation "nextInLine([5,6,7,8,9], 1) should return 5" shows I'm wrong.
However, when inserting manually the array '[5,6,7,8,9]' to testArr, and the argument '1' when calling the function, it returns '5'.
functionnextInLine(arr,item){testArr.push(item);item=testArr.shift();returnitem;// Change this line}vartestArr=[5,6,7,8,9];// Display Codeconsole.log("Before: "+JSON.stringify(testArr));console.log(nextInLine(testArr,1));// Modify this line to testconsole.log("After: "+JSON.stringify(testArr));
Screenshot
The text was updated successfully, but these errors were encountered:
Challenge Name: Stand in Line
https://www.freecodecamp.com/challenges/stand-in-line
Issue Description
When using push and shift function, the validation "nextInLine([5,6,7,8,9], 1) should return 5" shows I'm wrong.
However, when inserting manually the array '[5,6,7,8,9]' to testArr, and the argument '1' when calling the function, it returns '5'.
Browser Information
Code
Screenshot
The text was updated successfully, but these errors were encountered: