Created
November 2, 2020 14:42
-
-
Save ranamahmud/4f8fb1ee9ea7510f657760a3840da539 to your computer and use it in GitHub Desktop.
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 stack = []; | |
console.log(stack); | |
// [] // output | |
// insert a | |
stack.push("a"); | |
// insert b | |
stack.push("b"); | |
// insert c | |
stack.push("c"); | |
// print the stack | |
console.log(stack) | |
VM514:1 (3) ["a", "b", "c"] | |
// poping gives the top element c | |
stack.pop() | |
"c" | |
// popping gives next the top element b | |
stack.pop() | |
"b" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment