Returns true if the stack is empty, false otherwise.
Returns true if the stack is full, false otherwise. Note that a stack is only full if a maxSize option was provided at construction time.
Returns the number of items currently on the stack.
Returns the top-most item on the stack, without modifying the stack. If the stack is empty, returns undefined.
Iterate from bottom to top. Note that forEachFromTop iterates from top to bottom, so this is the reverse.
Iterate from top to bottom. Note that forEach iterates from bottom to top, so this is the reverse.
Pop the top-most item from the stack, and return it. If the stack is empty, returns undefined.
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