-
-
Save danieldrasdo/f33e150c3bad7489d585fade47756518 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
const x = 'abc'; // Coerces to true in a boolean context | |
const y = null; // Coerces to false in a boolean context | |
// "!" Creates a boolean context and returns the opposite. | |
const a = !x; // Value a is opposite of x, false. | |
const b = !y; // Value b is opposite of y, true. | |
if (a) { | |
// NOT executed. | |
} | |
if (b) { | |
// Executed. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment