optional array to initialize stack
to hold stack's data
Get the number of elements in stack
number of elements in stack
Check if stack is empty
true
if stack is empty else false
;
Peek the top element of a stack without removing it from stack
the last element of stack or undefined
if stack is empty
Returns the top element of stack
the top element of stack or undefined
if stack is empty
Push an element to stack
Generated using TypeDoc
Stack
Last in first out (LIFO) linear data structure
Example