Glossary: Data Structures and Algorithms in JavaScript
Push, pop, peek
Also written: push, pop, peek
Stack operations: push adds to the top, pop removes the top item, and peek looks at the top without removing it. All are O(1).
Glossary: Data Structures and Algorithms in JavaScript
Also written: push, pop, peek
Stack operations: push adds to the top, pop removes the top item, and peek looks at the top without removing it. All are O(1).