stack

            
class Stack {
    constructor(){
        this.storage = [];
    }
    //push data on
    push(value) {
        this.storage.push(value);
    }
    //pop data off
    pop() {
        if (this.storage.length === 0){
            //stack is empty
            return false;
        }
        return this.storage.pop();
    }
    //check stack length
    length() {
        return this.storage.length;
    }
    //print stack
    print() {
        return this.storage;
    }    
}

//create Stack
myStack = new Stack;
myStack.push('this');
myStack.push('is');
myStack.push('my');
myStack.push('test');
myStack.push('stack');

            
        

test results