Test name | Executions per second |
---|---|
findIndex | 1710.6 Ops/sec |
indexOf | 1394511.4 Ops/sec |
var arr = new Array(15000);
arr.fill({ id: 0 });
arr = arr.map((el, idx) => el.id = idx);
var foo = Math.floor(Math.random() * 15000);
var index = arr.findIndex((num) => num === foo);
var index = arr.indexOf(foo);