public
Last active

Variable shaddowing in coffee is to a problem!

  • Download Gist
variable-shaddowing-compiled.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12
(function() {
foo(function() {
var a1, a2;
a1 = void 0;
a2 = null;
return bar(function(value) {
a1 = value;
a2 = value;
return value;
});
});
}).call(this);
variable-shaddowing.coffee
CoffeeScript
1 2 3 4 5 6 7 8 9
# variable shadowing is not really a problem in coffee,
# you just need to be explicit, that you don't want to shadow it!
foo ->
a1 = undefined # long version
a2 = null # shorter (that I use personally) but not exactly same
bar (value)->
a1 = value
a2 = value
value

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.