class Stack { constructor() { this.stack = []; } push(el) { this.stack.push(el); } pop() { return this.stack.pop(); } } const createStack = function () { const stack = []; const push = (el) => stack.push(el); const pop = () => stack.pop(); return { push, pop }; }