# Stack

#### new Stack()

Create a FILO stack data structure.

Source:
  - datastructures/stack.js, line 7

### Methods

#### clear()

Clear the contents of the stack.

Source:
  - datastructures/stack.js, line 22

#### hasNext() → {boolean}

Checks if the stack isn't empty.

Source:
  - datastructures/stack.js, line 59

##### Returns:

Whether or not the stack has another element. True if yes.

Type
  boolean

#### isEmpty() → {boolean}

Checks if the stack is empty.

Source:
  - datastructures/stack.js, line 67

##### Returns:

Whether or not the stack is empty. True if yes.

Type
  boolean

#### peek() → {object}

Get the front element of the stack without removing it from the stack.

Source:
  - datastructures/stack.js, line 49

##### Returns:

Front element from the stack.

Type
  object

#### pop() → {object}

Get the front element of the stack and removes it from the stack.

Source:
  - datastructures/stack.js, line 38

##### Returns:

Front element from the stack.

Type
  object

#### push(obj)

Push an object in to the stack.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | object | Any object to be pushed into the stack.

Source:
  - datastructures/stack.js, line 30

#### size() → {number}

Get the number of objects in the stack.

Source:
  - datastructures/stack.js, line 15

##### Returns:

Number of elements in the stack.

Type
  number