quiz05.js 480 Bytes
"use strict";

function Stack (){
  this.arr = new Array();
  this.leng = 0;
  this.push = push;
  this.pop = pop;
}

function push(x) {
    this.arr[this.leng++] = x;
}

function pop (){
  return this.arr[this.leng--];
}

var stack = new Stack();
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
stack.push(5);

console.log(stack.pop());
console.log(stack.pop());
console.log(stack.pop());
console.log(stack.pop());
console.log(stack.pop());
console.log(stack.pop());