Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Chrome 61
Windows
Other
7 years ago
Test name Executions per second
indexOf first 6730044.0 Ops/sec
$.inArray first 2690684.0 Ops/sec
indexOf last 703890.3 Ops/sec
$.inArray last 605514.7 Ops/sec
indexOf middle 1297559.6 Ops/sec
$.inArray middle 1004696.7 Ops/sec
indexOf 451503.5 Ops/sec
$.inArray 338740.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray