tor-browser

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

slice-sparse-getter.js (294B)


      1 // Indexed getters can add new properties that slice should not ignore.
      2 var arr = [];
      3 Object.defineProperty(arr, 10000, {get: function() {
      4    arr[10001] = 4;
      5    return 3;
      6 }});
      7 arr[10010] = 6;
      8 
      9 var res = arr.slice(8000);
     10 assertEq(res[2000], 3);
     11 assertEq(res[2001], 4);
     12 assertEq(res[2010], 6);