我应该添加“use strict”吗?我的流星文件? [英] Should I add "use strict" to my meteor files?
问题描述
在javascript开发中以严格模式运行代码,方法是添加:
In javascript development running your code in strict mode by adding:
"use strict";
功能的开头是常见的最佳做法。但是我还没有看到有人在流星应用程序中这样做。
To the beginning of your functions is a common best practice. However I have yet to see anyone do so in a meteor application.
这种最佳做法不适用于Meteor吗?
Does this best practice not apply to Meteor?
也许是因为它在更高级别设置了严格模式?我知道可以使用--use-strict命令行参数运行该节点来强制执行此操作。但我不知道在客户端做同样的方法。
Maybe because it sets strict mode on a higher level? I know that node can be run with the --use-strict command line parameter to enforce this. But I do not know of a way to do the same in the client.
推荐答案
使用使用Meteor中的严格
仍然是一个很好的做法 - 它毕竟是JavaScript。
Using "use strict"
in Meteor is still a good practice - it is JavaScript after all.
这篇关于我应该添加“use strict”吗?我的流星文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!