tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

getelem-proto.js (297B)


      1 var a = [1, , 2];
      2 Array.prototype[1] = 3;
      3 
      4 function f(arr) {
      5    return arr[0] + arr[1] + arr[2];
      6 }
      7 for (var i=0; i<70; i++) {
      8    assertEq(f(a), 6);
      9 }
     10 
     11 Object.defineProperty(Array.prototype, "1", {
     12    get: function() {
     13        return 1234;
     14    }
     15 });
     16 
     17 assertEq(f(a), 1237);
     18 assertEq(f(a), 1237);