tor-browser

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

smallObjectVariableKeyHasProp-1.js (366B)


      1 let obj = {
      2  a: 1,
      3  b: 1,
      4  c: 1,
      5 };
      6 
      7 function test(id) {
      8  return Object.hasOwn(obj, id);
      9 }
     10 
     11 let testKeys = [
     12  ["a", true],
     13  ["b", true],
     14  ["c", true],
     15  ["d", false],
     16  ["e", false],
     17  ["f", false],
     18  ["g", false],
     19  ["h", false],
     20 ];
     21 
     22 with({});
     23 
     24 for (var i = 0; i < 1000; i++) {
     25  let [key, has] = testKeys[i % testKeys.length];
     26  assertEq(test(key), has);
     27 }