Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript if null use other value

let a          // undefined
let b = null
let c = false

a ??= true  // true
b ??= true  // true
c ??= true  // false

// Equivalent to
a = a ?? true
 
PREVIOUS NEXT
Tagged: #javascript #null
ADD COMMENT
Topic
Name
3+5 =