Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Chrome 56
Windows 7
Desktop
6 years ago
Test name Executions per second
indexOf first 7299154.0 Ops/sec
$.inArray first 2419934.2 Ops/sec
indexOf last 620219.5 Ops/sec
$.inArray last 507856.8 Ops/sec
indexOf middle 1397837.6 Ops/sec
$.inArray middle 783651.6 Ops/sec
indexOf 475505.7 Ops/sec
$.inArray 265651.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray