JSFiddle - React, Tailwind, and code Playground
by ZeNz0r
JavaScript
function nextInLine(a, i) {
const p = a.push(i)
const s = a.shift(i)
return s
}
const testArr = [1, 2, 3, 4, 5]
console.log("Before: " + JSON.stringify(testArr))
console.log(nextInLine(testArr, 6))
console.log("After: " + JSON.stringify(testArr))