Test name | Executions per second |
---|---|
indexOf | 922.1 Ops/sec |
includes | 902.5 Ops/sec |
find | 88.7 Ops/sec |
findIndex | 89.5 Ops/sec |
var arr = [];
var i = 0;
while (i <= 1E5) arr[i] = i++;
const index = arr.indexOf(1E5);
const included = arr.includes(1E5);
const item = arr.find(item => item == 1E5);
const index = arr.findIndex(item => item == 1E5);