Data Structures

Stack

Definition

A Last-In-First-Out (LIFO) data structure where elements are added and removed from the same end (the top). The JavaScript call stack is a stack. Common operations: push (add to top), pop (remove from top), peek (view top).

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms