Skip to content

Instantly share code, notes, and snippets.

@fuchodeveloper
Created November 16, 2019 15:49
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 fuchodeveloper/a0e0b6e032e37f11504681905cf8a5a1 to your computer and use it in GitHub Desktop.
Save fuchodeveloper/a0e0b6e032e37f11504681905cf8a5a1 to your computer and use it in GitHub Desktop.
// null value
null || 20 // returns 20
null ?? 20 // returns 20
// undefined value
undefined || 20 // returns 20
undefined ?? 20 // returns 20
// boolean
true ?? 10 // returns trueb
false ?? 10 // returns false
// NaN
NaN ?? 20 // returns NaN
// empty string
'' ?? 5 // returns ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment