Skip to content

Instantly share code, notes, and snippets.

@HamidOsouli-zz
Created November 10, 2018 21:55
Show Gist options
  • Save HamidOsouli-zz/f2ee36c83a2ea186acb7d972b20bce63 to your computer and use it in GitHub Desktop.
Save HamidOsouli-zz/f2ee36c83a2ea186acb7d972b20bce63 to your computer and use it in GitHub Desktop.
this is the multi conditional with ternary operator for Javascript
let i = true;
let j = 14;
ans = i ? (j > 10 ? (j%7 === 7 ? 14 : 54 ) : 66) : 99;
// returns 14 because i === true && j > 10 && j%7 === 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment