Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Chrome 66
Mac OS X 10.13.4
Other
6 years ago
Test name Executions per second
indexOf first 5278680.0 Ops/sec
$.inArray first 2151276.2 Ops/sec
indexOf last 423810.4 Ops/sec
$.inArray last 382706.6 Ops/sec
indexOf middle 777786.7 Ops/sec
$.inArray middle 663880.1 Ops/sec
indexOf 271769.9 Ops/sec
$.inArray 224752.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray