Skip to content

Instantly share code, notes, and snippets.

@stefanfrede
Created February 1, 2016 06:34
Show Gist options
  • Save stefanfrede/e6734dff0d1b6693b2bb to your computer and use it in GitHub Desktop.
Save stefanfrede/e6734dff0d1b6693b2bb to your computer and use it in GitHub Desktop.
Convert a truthy or falsy value to true boolean with the !! operator.
!!"" // false
!!0 // false
!!null // false
!!undefined // false
!!NaN // false
!!"hello" // true
!!1 // true
!!{} // true
!![] // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment