Skip to content

Instantly share code, notes, and snippets.

@thisismydesign
Created February 1, 2019 20:57
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 thisismydesign/298cabef78acf8796ea29874e73fb394 to your computer and use it in GitHub Desktop.
Save thisismydesign/298cabef78acf8796ea29874e73fb394 to your computer and use it in GitHub Desktop.
JavaScript is not a language
// https://codeburst.io/javascript-null-vs-undefined-20f955215a2
// With default parameters, `null` does not use default parameters
let logDefault = (str = 'default') => {
console.log(str);
}
logHi();
// => hi
logHi(undefined);
// => hi
logHi(null);
// => null
// https://codeburst.io/javascript-null-vs-undefined-20f955215a2
// `null` is a primitive with an object type
typeof null
// => "object"
// https://www.destroyallsoftware.com/talks/wat
[] + []
// => ""
// https://www.destroyallsoftware.com/talks/wat
[] + {}
// => "[object Object]"
{} + []
// => 0
{} + {}
// => NaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment