Stack
Stack: LIFO data structure Usage: let stack = new Stack(); stack.push('A'); stack.push('B'); stack.pop(); => B'
Constructor Summary
| Public Constructor | ||
| public |
|
|
Method Summary
| Public Methods | ||
| public |
clear(): void Clears out all items from the Stack. |
|
| public |
Gets number of items currently on the stack. |
|
| public |
Returns boolean value based on contents of stack. |
|
| public |
pop(): <Item> returns last value pushed onto Stack; modifies Stack items in-place |
|
| public |
|
|
| public |
push(value: item): void Appends an item to the top of the Stack. |
|
Public Constructors
public constructor source
Public Methods
public pop(): <Item> source
returns last value pushed onto Stack; modifies Stack items in-place
Return:
| <Item> | last value pushed onto Stack. |
Throw:
if stack is empty. |
public push(value: item): void source
Appends an item to the top of the Stack.
Params:
| Name | Type | Attribute | Description |
| value | item | to push onto the top of the Stack |
Return:
| void |