Skip to content

Instantly share code, notes, and snippets.

@joepie91
Last active July 9, 2017 11:47
Show Gist options
  • Save joepie91/5fd8c58345998d4dec5b to your computer and use it in GitHub Desktop.
Save joepie91/5fd8c58345998d4dec5b to your computer and use it in GitHub Desktop.
Boolean casting in Node.js
> !!(false)
false
> !!(0)
false
> !!("")
false
> !!(null)
false
> !!(undefined)
false
> !!("0")
true
> !!("test")
true
> !!(-1)
true
> !!(true)
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment