Two-array implementation of queue (.push, .shift) for JavaScript