Functions in coffeescript

Hi, I just tried this code on coffeescript.org

a = (msg) →
alert msg

a(“booo”)

and it worked fine. When I put the first part of it (defining a) in a
.js.coffee file and call a(“booo”); in my view it simply doesn’t work.
This is the error firebug throws out:

a is not defined
[Break On This Error]

a(“boom thata”);


This is what the compiled js file looks like:

(function() {
var a;
a = function(msg) {
return alert(msg);
};
}).call(this);

What went wrong?

OK, found answer

put it like this:

@a = (msg) ->
alert msg

in coffeescript file. This will make variable a global