When should I use ?? (nullish coalescing) vs || (logical OR)?
09:04 28 Apr 2020

Related to Is there a "null coalescing" operator in JavaScript? - JavaScript now has a ?? operator which I see in use more frequently. Previously most JavaScript code used ||.

let userAge = null

// These values will be the same. 
let age1 = userAge || 21
let age2 = userAge ?? 21

In what circumstances will ?? and || behave differently?

javascript logical-or nullish-coalescing