Skip to content

Instantly share code, notes, and snippets.

@prof3ssorSt3v3
Created August 7, 2017 18:46
Show Gist options
  • Save prof3ssorSt3v3/8acd2837126f9c68231b0bb014982620 to your computer and use it in GitHub Desktop.
Save prof3ssorSt3v3/8acd2837126f9c68231b0bb014982620 to your computer and use it in GitHub Desktop.
// Truthy and Falsy in JavaScript
// Boolean-ish
// null, undefined, 0, false, '', "", NaN - FALSEY
//
let log = console.log;
let es = "";
let z = 0;
let n = null;
let u = undefined;
let f = false;
let i = NaN;
if(es || z || n || u || f || i ){
log('The true part')
}else{
log('The false part')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment