Stack is dynamical data structure add-on to JS that allows you to create stacks and work with them.
const Stack = require('avkrash-stack');
var stack = new Stack();
stack.push(15);
stack.push({'foo':1,'bar':'tender'});
stack.peek(); //returns '15'
stack.peek(); //returns '15'
stack.pop(); //returns '15' and removes top element
stack.peek(); //returns "{'foo':1,'bar':'tender'}"
stack.pop(); //returns "{'foo':1,'bar':'tender'}" and removes last element from stack
stack.isEmprty(); //returns 'true'
npm install avkrash-stack
npm test
P.S.: for additional info see JSDocs