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