/* Stack, array implementation http://www.cs.usfca.edu/~galles/visualization/StackArray.html */ class Stack { constructor() { this._stack = []; this._index = -1; } push(value) { this._index++; this._stack[this._index] = value; } pop() { const resultingArray = this._stack.splice(this._index, 1); this._index--; return resultingArray[0]; } }