Created
December 5, 2020 15:38
-
-
Save smpnjn/bd6a663bb6f567a69405f9da120a0865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = ''; | |
let a = (3 - 3) || "this is falsy"; // returns "this is falsy" - 3 - 3 = 0 which is falsy | |
let b = (3 - 3) ?? "this is nullish"; // returns 0 - 3 - 3 = 0 which is not null or undefined | |
let c = foo || "this is falsy"; // returns "this is falsy" - since '' is falsy | |
let d = foo ?? "this is nullish"; // returns '' - since '' is not null or undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment