Skip to content

Instantly share code, notes, and snippets.

@periakteon
Last active March 13, 2023 11:29
Show Gist options
  • Save periakteon/7b50ff6ab432540c81565c150dc1bf3d to your computer and use it in GitHub Desktop.
Save periakteon/7b50ff6ab432540c81565c150dc1bf3d to your computer and use it in GitHub Desktop.
Stand in Line
function nextInLine(arr, item) {
return item;
}
let testArr = [1, 2, 3, 4, 5];
console.log("Before: " + JSON.stringify(testArr));
// Before: [1,2,3,4,5]
console.log(nextInLine(testArr, 6));
// 6
console.log("After: " + JSON.stringify(testArr));
// After: [1,2,3,4,5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment