Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Chrome 101
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
includes 8513046.0 Ops/sec
lookup 14175337.0 Ops/sec
indexof 8470186.0 Ops/sec
Script Preparation code:
AخA
 
var a = [
  'height',
  'width',
  'maxHeight',
  'maxWidth',
  'maxHeight',
  'minWidth',
  'color',
  'bg',
  'backgroundColor',
  'opacity',
  'm',
  'mt',
  'mb',
  'mr',
  'mr',
  'mx',
  'my',
  'p',
  'pt',
  'pb',
  'pr',
  'pl',
  'px',
  'py',
  'border',
  'boxShadow',
  'flex',
  'verticalAlign',
  'textAlign',
  'overflow',
  'display',
  'cursor'
];
var b = new Set(a)
Tests:
  • includes

     
    return a.includes('mx')
  • lookup

     
    return b.has('mx')
  • indexof

     
    return a.indexOf('mx') >= 0