Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Not so cool at all.
CoffeeScript:
end = ->
test = (x) ->
console.log(x)
end()
test2 = (x, y) ->
x + y
end()
JavaScript:
(function() {
var end, test;
end = function() {};
test = function(x) {
console.log(x);
return end;
};
}).call(this);
Problems:
1. Ugly,
2. You'd lose the "return last statement" feature of CoffeScript. end() returns undefined and that's a problem in test2.
Solution:
Add a noop keyword so CoffeScript code would be:
test2 = (x, y) ->
x + y
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.