这个小CoffeeScript包含一个错字

drinks = "Coffee"
drinks = drinks + ", " + "Tea"
drinsk = drinks + ", " + "Lemonade"
alert drinks

意图是提醒“咖啡,茶,柠檬水”,但结果却是“咖啡,茶”。
生成的JavaScript仍然有效,并传递JSLint;它在使用前声明变量
是好的,但是它的变量错误。
var drinks, drinsk;
drinks = "Coffee";
drinks = drinks + ", " + "Tea";
drinsk = drinks + ", " + "Lemonade";
alert(drinks);

如果使用纯JavaScript编写相同的示例,则JSLint将捕获错误:
var drinks;
drinks = "Coffee";
drinks = drinks + ", " + "Tea";
drinsk = drinks + ", " + "Lemonade";
alert(drinks);

------------------
Problem at line 4 character 1: 'drinsk' was used before it was defined.
drinsk = drinks + ", " + "Lemonade";

问题:是否可以保留我所犯的错误,以便我能够找到它们?我希望看到像JSLint这样的工具仍然可以使用。

还尝试了http://www.coffeelint.org/,它告诉我“您的代码不掉毛!”

最佳答案

您可以使用支持标识符拼写检查的IDE,例如IntelliJ IDEA,其BTW具有用于CoffeScript编辑的插件。

07-26 06:54