Skip to content

Instantly share code, notes, and snippets.

@bazzooka
Created March 30, 2016 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bazzooka/59ee442bd9983537ef536bacd13ec1ff to your computer and use it in GitHub Desktop.
Save bazzooka/59ee442bd9983537ef536bacd13ec1ff to your computer and use it in GitHub Desktop.
Javacript simple queue with no performance consideration
var Queue = function(size){
this.list = new Array(size || 10);
return this;
}
Queue.prototype.enqueue = function(elem){
this.list.shift(); // remove first element
this.list.push(elem);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment