Run details:
Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Chrome 94
Fedora
Desktop
3 years ago
Test name Executions per second
IndexOf 13612573.0 Ops/sec
Includes 14636807.0 Ops/sec
some 13165847.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')