Created
May 10, 2020 21:11
-
-
Save Nathan-Nesbitt/643e2fba9aab03996d1ea46b785d24bd to your computer and use it in GitHub Desktop.
Queue Example JavaScript
This file contains hidden or 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
// Example Queue // | |
var queue = []; | |
// Enqueue the values // | |
queue.push(1); | |
queue.push(2); | |
queue.push(3); | |
// Dequeue and print the values // | |
console.log(queue.shift()); | |
console.log(queue.shift()); | |
console.log(queue.shift()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample code for https://nathan.nesbitt.ca/blog-posts/IntroductionToJavascript.html