Test name | Executions per second |
---|---|
findIndex | 28003.5 Ops/sec |
indexOf | 1375891.9 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);