Methods
hasNext() → {boolean}
Checks if the stack isn't empty.
- Source:
Returns:
- Type:
-
boolean
Whether or not the stack has another element. True if yes.
isEmpty() → {boolean}
Checks if the stack is empty.
- Source:
Returns:
- Type:
-
boolean
Whether or not the stack is empty. True if yes.
peek() → {object}
Get the front element of the stack without removing it from the stack.
- Source:
Returns:
- Type:
-
object
Front element from the stack.
pop() → {object}
Get the front element of the stack and removes it from the stack.
- Source:
Returns:
- Type:
-
object
Front element from the stack.
push(obj)
Push an object in to the stack.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
obj |
object
|
Any object to be pushed into the stack. |
size() → {number}
Get the number of objects in the stack.
- Source:
Returns:
- Type:
-
number
Number of elements in the stack.