Skip to content

Instantly share code, notes, and snippets.

@code-reaper08
Created August 10, 2021 17:42
Show Gist options
  • Save code-reaper08/52dd719332190d450450760f38447db5 to your computer and use it in GitHub Desktop.
Save code-reaper08/52dd719332190d450450760f38447db5 to your computer and use it in GitHub Desktop.
undefined vs null
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