Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
Chrome 75
Windows
Desktop
5 years ago
Test name Executions per second
indexOf first 7235737.0 Ops/sec
$.inArray first 2440854.0 Ops/sec
indexOf last 7402209.5 Ops/sec
$.inArray last 491770.7 Ops/sec
indexOf middle 6244627.5 Ops/sec
$.inArray middle 836490.4 Ops/sec
indexOf 2804759.0 Ops/sec
$.inArray 274779.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray