Skip to content

Instantly share code, notes, and snippets.

@filipesperandio
Last active November 20, 2018 18:59
Show Gist options
  • Save filipesperandio/09d30ee5e46ed0c7f94ea3a96c76d82d to your computer and use it in GitHub Desktop.
Save filipesperandio/09d30ee5e46ed0c7f94ea3a96c76d82d to your computer and use it in GitHub Desktop.
> function validate(isValid) { return isValid || !isValid }
undefined
> validate(true)
true
> validate(false)
true
> validate(undefined)
true
> validate(null)
true
> validate(1)
1
> validate(0)
true
> validate("a")
'a'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment