Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36
Chrome 64
Windows 7
Other
2025 years ago
Test name Executions per second
indexOf first 7873078.0 Ops/sec
$.inArray first 2552041.0 Ops/sec
indexOf last 615861.2 Ops/sec
$.inArray last 521735.8 Ops/sec
indexOf middle 1132580.6 Ops/sec
$.inArray middle 874408.3 Ops/sec
indexOf 374845.2 Ops/sec
$.inArray 278871.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray