True if stack is empty
True if stack is at its capacity. False if not, or if there is no capacity.
Number of items in stack
Get the item at the top of the stack without removing it (like pop
would do)
Item at the top of the stack, or undefined if empty.
Push data onto the stack.
If toAdd
is empty, nothing happens
Data to add
Length of stack
Creates a stack. Mutable. Use StackImmutable for an immutable alternative.
Example: Basic usage