Created
March 15, 2015 05:13
-
-
Save JakeSidSmith/87b2c1422d514109a595 to your computer and use it in GitHub Desktop.
Messing around with potentially nicer ways to write ternaries
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 ternary = function (bool, success, fail) { | |
return bool ? success : fail; | |
}; | |
var message = ternary(true, 'Hello', ternary(true, 'Werld', 'World')); | |
console.log(message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment