I notice that in CoffeeScript, if I define a function using:
a = (c) -> c=1
I can only get the function expression:
var a;
a = function(c) {
return c = 1;
};
But, personally I often use function declaration,for example:
function a(c) {
return c = 1;
}
I do use the first form, but I'm wondering if there is a way in CoffeeScript generating a function declaration. If there is no such way, I would like to know why CoffeeScript avoid doing this. I don't think JSLint would holler an error for declaration, as long as the function is declared at the top of the scope.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…