Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Chrome 55
Windows
Other
7 years ago
Test name Executions per second
indexOf first 6043168.5 Ops/sec
$.inArray first 2087673.1 Ops/sec
indexOf last 340702.2 Ops/sec
$.inArray last 304155.1 Ops/sec
indexOf middle 641104.5 Ops/sec
$.inArray middle 529589.2 Ops/sec
indexOf 212063.9 Ops/sec
$.inArray 172849.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray