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