Skip to content

Instantly share code, notes, and snippets.

@caillou
Last active August 29, 2015 13:57
Show Gist options
  • Save caillou/9758270 to your computer and use it in GitHub Desktop.
Save caillou/9758270 to your computer and use it in GitHub Desktop.
CoffeeScript is mad!
(->
x = ->
foo = false
# If a variable is used after a function definition
# for the first time...
foo = true
)()
(function() {
var foo, x;
x = function() {
// ... CoffeeScript adds a var keyword.
var foo;
return foo = false;
};
return foo = true;
})();
(->
# If a variable is used before a function definition
# for the first time...
foo = true
x = ->
foo = false
)()
(function() {
var foo, x;
foo = true;
return x = function() {
// ... it doesn't add the var keyword
return foo = false;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment