.pop()

Christine_Yang265 total contributions
Published Jul 29, 2022Updated Dec 21, 2022
Contribute to Docs
The .pop()
method removes the last item added to the top of the stack
, reducing its size by one.
Syntax
The .pop()
method is called on a stack using the following syntax:
stackName.pop();
Codebyte Example
The following example features a stack myStack
that is initially populated with values. The top two are removed with the .pop()
method:
All contributors
- Christine_Yang265 total contributions
- garanews209 total contributions
- StevenSwiniarski466 total contributions
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.