Home Reference Source
public class | source

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 clear(): void source

Clears out all items from the Stack.

Return:

void

public count(): Number source

Gets number of items currently on the stack.

Return:

Number

public isEmpty(): Boolean source

Returns boolean value based on contents of stack.

Return:

Boolean

true if Stack is empty, otherwise false.

public pop(): <Item> source

returns last value pushed onto Stack; modifies Stack items in-place

Return:

<Item>

last value pushed onto Stack.

Throw:

StackEmptyError

if stack is empty.

public print(): String source

Return:

String

string representation of the Stack structure

public push(value: item): void source

Appends an item to the top of the Stack.

Params:

NameTypeAttributeDescription
value item

to push onto the top of the Stack

Return:

void