Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Windows
Desktop
4 years ago
Test name Executions per second
includes 11180123.0 Ops/sec
lookup 11449933.0 Ops/sec
Script Preparation code:
AخA
 
var a = [];
for(let i = 0; i < 1000; i++){
  a.push(i);
}
var b = new Set(a)
Tests:
  • includes

     
    return a.includes(500)
  • lookup

     
    return b.has(500)