Skip to content

Instantly share code, notes, and snippets.

@osha7
Last active February 28, 2021 00:09
Show Gist options
  • Save osha7/c8c98c48419177c45c80d203f92a11e9 to your computer and use it in GitHub Desktop.
Save osha7/c8c98c48419177c45c80d203f92a11e9 to your computer and use it in GitHub Desktop.
const stack = []
// add items to the stack:
stack.push('Batman')
stack.push('Spider-Man')
stack.push('Wonder Woman')
stack.push('Black Panther')
stack
// ==> ['Batman', 'Spider-Man', 'Wonder Woman', 'Black Panther']
// remove items from the stack:
stack.pop()
stack
// ==> ['Batman', 'Spider-Man', 'Wonder Woman']
stack.pop()
stack
// ==> ['Batman', 'Spider-Man']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment