Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109
Windows
Desktop
one year ago
Test name Executions per second
wUmrLVWz 1.0 Ops/sec
1 waitfor delay '0:0:15' -- 1.0 Ops/sec
wUmrLVWz 1.0 Ops/sec
wUmrLVWz 1.0 Ops/sec
wUmrLVWz 1.0 Ops/sec
Script Preparation code:
AخA
 
var x = 3;
var list = [undefined, NaN, null, ''];
Tests:
  • Array.includes

     
    [undefined, NaN, null, ''].includes(x)
  • Or chain

     
    x === undefined 
        || Number.isNaN(x)
        || x ===  null 
        || x ===  ''
  • Or chain (witch cheap 'undefined' check)

     
    typeof x === 'undefined' 
        || Number.isNaN(x)
        || x ===  null 
        || x ===  ''
  • Array.includes with predefined list

     
    list.includes(x)
  • Array.includes with predefined list (witch cheap 'undefined' check)

     
    typeof x === 'undefined' || list.includes(x)