Created
May 10, 2020 21:09
-
-
Save Nathan-Nesbitt/3dea0b392b23a00921b64cd6a8a48694 to your computer and use it in GitHub Desktop.
Stack 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
// Create a "stack" // | |
var stack = []; | |
// Push values onto the stack // | |
stack.push(3); | |
stack.push(2); | |
stack.push(1); | |
// Print off the order that the values are in // | |
console.log(stack.pop()); | |
console.log(stack.pop()); | |
console.log(stack.pop()); |
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