Implementing the Queue Data Structure in Javascript