Last active
August 26, 2017 05:05
-
-
Save abinavseelan/89febea5ac4a736e67df22107ca6ef5d to your computer and use it in GitHub Desktop.
Medium - DS in Javascript - push Method
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
function Queue() { | |
this.values = []; | |
this.count = 0; | |
} | |
Queue.prototype.enqueue = (newValue) => { | |
this.values[this.count] = newValue; // Insert the new value in the end | |
this.count++; // Update the count to reflect the addition | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment