Created
March 5, 2015 03:20
-
-
Save akrawchyk/16ffe8c128e03e58b546 to your computer and use it in GitHub Desktop.
ternary operator js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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