Created
September 29, 2011 19:10
-
-
Save ryanflorence/1251639 to your computer and use it in GitHub Desktop.
CoffeeScript Immediately Invoked Function Expressions
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
increment = do -> | |
x = 0 | |
-> | |
x++ |
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 increment = (function (){ | |
var x = 0; | |
return function (){ | |
return x++; | |
} | |
}()); |
How does this reduce readability? I think do ->
reads just fine...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Characters reduced by: 62.5%
Readability reduced by: 80%