Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Windows 7
Desktop
6 years ago
Test name Executions per second
indexOf first 3924764.5 Ops/sec
$.inArray first 1432829.0 Ops/sec
indexOf last 3352731.5 Ops/sec
$.inArray last 373123.6 Ops/sec
indexOf middle 3226103.0 Ops/sec
$.inArray middle 454293.1 Ops/sec
indexOf 1513142.5 Ops/sec
$.inArray 201725.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray