Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 OPR/80.0.4170.40
Opera 80
Linux
Desktop
3 years ago
Test name Executions per second
IndexOf 13716997.0 Ops/sec
Includes 14571139.0 Ops/sec
some 13653582.0 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var array = ['banana', 'sausage', 'jesus']
Tests:
  • IndexOf

     
    array.indexOf('sausage') !== 1
  • Includes

     
    array.includes('sausage')
  • some

     
    array.some(v => v === 'sausage')