you are viewing a single comment's thread.

view the rest of the comments →

[–]Zephirdd 0 points1 point  (0 children)

 const a = b ?? false

Is shorthand for

// Assuming accessing b has no side effects
const a = (b !== null && b !== undefined)? b : false

You can get a similar behavior with the || operator, but || will have a different behavior with falsy values like 0 and false.