Created
March 30, 2016 11:53
-
-
Save bazzooka/59ee442bd9983537ef536bacd13ec1ff to your computer and use it in GitHub Desktop.
Javacript simple queue with no performance consideration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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