/* Stack data-structure. It's work is based on the LIFO method (last-IN-first-OUT). * It means that elements added to the stack are placed on the top and only the * last element (from the top) can be reached. After we get access to the last * element, he pops from the stack. * This is a class-based implementation of a Stack. It provides functions * 'push' - to add an element, 'pop' - to remove an element from the top. * Also it implements 'length', 'last' and 'isEmpty' properties and * static isStack method to check is an object the instance of Stack class. */ // Class declaration class Stack { constructor () { this.stack = [] this