Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:129.0) Gecko/20100101 Firefox/129.0
Firefox 129
Mac OS X 10.15
Desktop
5 months ago
Test name Executions per second
Array.prototype.find 3289.4 Ops/sec
Array.prototype.findIndex 3325.0 Ops/sec
Script Preparation code:
x
 
var arr = [];
var i = 0;
while (i <= 1E5) arr[i] = i++;
Tests:
  • Array.prototype.find

     
    const item = arr.find(item => item == 1E5);
  • Array.prototype.findIndex

     
    const index = arr.findIndex(item => item == 1E5);