Short JavaScript implementation of queue