Stack

Stack

Class Representing a Stack

Constructor

new Stack()

Source:

Methods

peek() → {number}

Source:
Returns:
Type:
number
return the peek element

pop() → {number|string}

Source:
Returns:
Type:
number | string
remove one element from top | message str if empty stack

printStack() → {str}

Source:
Returns:
Type:
str
all the element to in string format

push(element)

Source:
Parameters:
Name Type Description
element number add element on top