在coffeescript中有没有更优雅的方法来声明全局变量?
我发现,在编写快速脚本时,我的很多coffee代码都包含这样的块:在coffeescript中有没有更优雅的方法来声明全局变量?,coffeescript,Coffeescript,我发现,在编写快速脚本时,我的很多coffee代码都包含这样的块: somevariable = someotherglobalvariable = yetanotherglobalvariable = undefined 有没有更漂亮的方式来写这个 我认为对于更漂亮/更干净的代码,应该避免链初始化 somevariable = undefined someotherglobalvariable = undefined yetanotherglobalvariable = undefin
somevariable =
someotherglobalvariable =
yetanotherglobalvariable = undefined
有没有更漂亮的方式来写这个 我认为对于更漂亮/更干净的代码,应该避免链初始化
somevariable = undefined
someotherglobalvariable = undefined
yetanotherglobalvariable = undefined
如果您想使这个vars成为全局的,您应该像在javascript中一样使用window