Skip to content

Instantly share code, notes, and snippets.

@NickyMeuleman
Last active February 28, 2020 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickyMeuleman/0904c970ada7e145f5aa35ff9062851b to your computer and use it in GitHub Desktop.
Save NickyMeuleman/0904c970ada7e145f5aa35ff9062851b to your computer and use it in GitHub Desktop.
logical OR vs nullish coalescing
const value = 0
const defaultWithLogicalOR = value || 1
// result: 1
const defaultWithNullishCoalescing = value ?? 1;
// result: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment