以下 CoffeeScript:greet = -> "This is an example of a function"編譯時(shí)生成以下 JavaScript 代碼:(function() { var greet; greet = function() { return "This is an example of a function"; };}).call(this);我的問題是,為什么 JavaScript 不創(chuàng)建像這樣的單個(gè)函數(shù):(var greet = function() { return "This is an example of a function"};}).call(this);
在 CoffeeScript / JS 中將函數(shù)分配給 vars
Qyouu
2022-12-09 15:34:50