我应该添加“使用严格"吗?到我的流星文件? [英] 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 中使用 "use strict"
仍然是一个很好的做法 - 毕竟它是 JavaScript.
Using "use strict"
in Meteor is still a good practice - it is JavaScript after all.
这篇关于我应该添加“使用严格"吗?到我的流星文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!