Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
Chrome 76
Windows 7
Desktop
5 years ago
Test name Executions per second
indexOf first 8996852.0 Ops/sec
$.inArray first 2933278.2 Ops/sec
indexOf last 9346241.0 Ops/sec
$.inArray last 618011.2 Ops/sec
indexOf middle 8992617.0 Ops/sec
$.inArray middle 1022658.4 Ops/sec
indexOf 3080135.0 Ops/sec
$.inArray 329482.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray