Created
August 10, 2021 17:42
-
-
Save code-reaper08/52dd719332190d450450760f38447db5 to your computer and use it in GitHub Desktop.
undefined vs null
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 a; | |
let b = null; | |
if (a === undefined) { | |
console.log("It is undefined, as it is not assigned any value."); | |
} else | |
console.log("It is not undefined"); | |
if (b === null) { | |
console.log("The value is null, since it was the one assigned.") | |
} else | |
console.log("It is not null") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment