Constructor
new Stack()
- Description:
- Creates a new stack.
- Source:
Examples
// without chaining
const stack = new Stack();
stack.push(bottom);
stack.push(middle);
stack.push(top);
// with chaining
const stack = new Stack().push(bottom).push(middle).push(top);
Methods
clear() → {this}
- Description:
- Clears the stack.
- Source:
Returns:
- Type
- this
pop() → {T|undefined}
- Description:
- Pops an item.
- Source:
Returns:
- Type
- T | undefined
push($item) → {this}
- Description:
- Pushes an item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$item |
T | The item to push. |
Returns:
- Type
- this