Self invoking Coffeescript
$ ->
alert "Hello CoffeeScript!"
Compiles to
$(function() {
return alert("Hello CoffeeScript!");
});
Now, the same code -- $ replaced with any other variable -->
hello= ->
alert "Hello CoffeeScript!"
Above code - Does not execute by itself.
How does giving a $
variable enable self execution(jQuery lib not included)? (is jQuery is playing a role here?)
I know you've to use do
to have self invoking functions in coffeescript
--- that's not my question ( please do not duplicate it ).
-coffeescript beginner