Last active
August 29, 2015 14:00
-
-
Save jherdman/9f25342be9133696d55c to your computer and use it in GitHub Desktop.
Fuck you, CoffeeScript
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
defaultFoo = 10 | |
foo = 3 | |
foo = (defaultFoo > foo) ? defaultFoo : foo | |
console.log(foo) | |
=> true |
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 defaultFoo = 10, | |
foo = 3; | |
foo = (defaultFoo > foo) ? defaultFoo : foo; | |
console.log(foo); | |
=> 10 |
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 foo, _ref, defaultFoo; | |
foo = 3; | |
defaultFoo = 10; | |
foo = (_ref = defaultFoo > foo) != null ? _ref : { | |
defaultFoo: foo | |
}; | |
console.log(foo); | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is nothing wrong with CoffeeScript. CoffeeScript has never had an explicit ternary statement. What you did is not CoffeeScript. Here is your solution: