@@ -0,0 +1,1079 @@
+var MyQueue = function () %7B%0A  this.data = new stack()%0A%7D%0AMyQueue.prototype.push = function (v) %7B%0A  var temp = new stack()%0A  while (!this.data.empty()) %7B%0A    temp.push(this.data.pop())%0A  %7D%0A  temp.push(v)%0A  while (!temp.empty()) %7B%0A    this.data.push(temp.pop())%0A  %7D%0A%7D%0AMyQueue.prototype.pop = function () %7B%0A  return this.data.pop()%0A%7D%0AMyQueue.prototype.peek = function () %7B%0A  return this.data.top()%0A%7D%0AMyQueue.prototype.empty = function () %7B%0A  return this.data.empty()%0A%7D%0A%0Avar stack = function () %7B%0A  this.data = %5B%5D%0A%7D%0A%0Astack.prototype.push = function (v) %7B%0A  this.data.push(v)%0A%7D%0Astack.prototype.pop = function () %7B%0A  return this.data.pop()%0A%7D%0Astack.prototype.top = function () %7B%0A  return this.data%5Bthis.data.length - 1%5D%0A%7D%0Astack.prototype.empty = function () %7B%0A  return !this.data.length%0A%7D%0A%0Avar a = new MyQueue()%0Aa.push(1)%0Aa.push(2)%0Aa.push(3)%0Aa.push(4)%0Aconsole.log(a.pop())%0Aconsole.log(a.pop())%0Aconsole.log(a.pop())%0Aconsole.log(a.pop())%0A%0A/* var b = new stack()%0Ab.push(1)%0Ab.push(2)%0Ab.push(3)%0Ab.push(4)%0Aconsole.log(b.pop())%0Aconsole.log(b.pop())%0Aconsole.log(b.pop())%0Aconsole.log(b.pop()) */%0A

implement queues using stack