Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Firefox 102
Ubuntu
Desktop
2 years ago
Test name Executions per second
Array.find 1010.7 Ops/sec
Array.indexOf 5244.6 Ops/sec
Script Preparation code:
x
 
var arr = [];
var i = 0;
while (i <= 1E5) arr[i] = i++;
Tests:
  • Array.find

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

     
    const index = arr.indexOf(1E5);