Skip to content

Instantly share code, notes, and snippets.

@cmmartin
Last active May 7, 2021 05:24
Show Gist options
  • Save cmmartin/e54157d2b7e891a8512b to your computer and use it in GitHub Desktop.
Save cmmartin/e54157d2b7e891a8512b to your computer and use it in GitHub Desktop.
Javascript lies
null + null === 0 // true
[] + [] === '' // true
null + 1 === 1 // true
isNaN(null) // false
NaN === NaN // false
undefined == null // true
16.19 * 100 === 1619 // false
0.1 + 0.2 === 0.3 // false
typeof null === 'object' // true
// lisp?
var x = (Math.pow, 1, 1); x // 1
document.all
// HTMLAllCollection[1045]
typeof document.all
// "undefined"
document.all === undefined
// false
3.5 * '18' // 63
parseInt(0.00000000000434, 10) // 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment