Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0
Firefox 71
Windows
Desktop
5 years ago
Test name Executions per second
indexOf first 114267952.0 Ops/sec
$.inArray first 13565630.0 Ops/sec
indexOf last 791693.9 Ops/sec
$.inArray last 790794.8 Ops/sec
indexOf middle 1520687.0 Ops/sec
$.inArray middle 1575798.0 Ops/sec
indexOf 453772.6 Ops/sec
$.inArray 455916.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray