Started queue implementation in JavaScript