Skip to content

Instantly share code, notes, and snippets.

@akrawchyk
Created March 5, 2015 03:20
Show Gist options
  • Save akrawchyk/16ffe8c128e03e58b546 to your computer and use it in GitHub Desktop.
Save akrawchyk/16ffe8c128e03e58b546 to your computer and use it in GitHub Desktop.
ternary operator js
var jobsCountRemaining = 2;
// ternary
var completed = jobsCountRemaining === 0 ? true : false;
return completed;
// if-else
if (jobsCountRemaining === 0) {
completed = true;
} else {
completed = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment