Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Chrome 66
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 10031369.0 Ops/sec
$.inArray first 3058712.2 Ops/sec
indexOf last 760771.0 Ops/sec
$.inArray last 633827.8 Ops/sec
indexOf middle 1389050.8 Ops/sec
$.inArray middle 1043955.9 Ops/sec
indexOf 460236.7 Ops/sec
$.inArray 339222.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray