SHARE
TWEET

Untitled

a guest Jun 16th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ImmutableStack {
  2.   constructor(arr) {
  3.     this.arr = arr;
  4.   }
  5.   push(val) {
  6.     let immutableStack = this.arr.slice();
  7.     this.arr.push(val);
  8.     return immutableStack;
  9.   }
  10.   pop() {
  11.     let immutableStack = this.arr.slice();
  12.     this.arr.pop();
  13.     return immutableStack;
  14.   }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top