Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Chrome 62
Mac OS X 10.12.6
Other
7 years ago
Test name Executions per second
indexOf first 4524407.0 Ops/sec
$.inArray first 1803800.0 Ops/sec
indexOf last 374094.9 Ops/sec
$.inArray last 335871.8 Ops/sec
indexOf middle 689599.4 Ops/sec
$.inArray middle 559632.1 Ops/sec
indexOf 244000.0 Ops/sec
$.inArray 190821.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray