Node.js:如何在V8引擎中启用non strict或ECMASCRIPT3?
我相信V8底层Node.js默认支持严格模式或ES5。
我们可以在V8引擎中启用非严格或ECMASCRIPT 3吗?
Chrome(V8)中几乎有100%的ES5function可用,请参阅兼容性表 。
但是一些开发人员(包括我)仍然对ES3感到满意,我们可以有这个select吗?
只是不要在你的代码中包含string"use strict"
。 V8支持严格模式,除非您告诉它(即遵循ES5规范),否则不会使用它。
比较以下脚本:
input:
foo = "Hello"; console.log(foo);
输出:
quentin@workstation:tmp # node test.js Hello
和
input:
"use strict"; foo = "Hello"; console.log(foo);
输出:
quentin@workstation:tmp # node test.js node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ ReferenceError: foo is not defined at Object.<anonymous> (/Users/quentin/tmp/test.js:2:5) at Module._compile (module.js:432:26) at Object..js (module.js:450:10) at Module.load (module.js:351:31) at Function._load (module.js:310:12) at Array.0 (module.js:470:10) at EventEmitter._tickCallback (node.js:192:40)
- 节点检查器debugging
- 如何撤消Object.defineProperty调用?
- Socket.IO不能在Windows和Chrome上运行
- Node.js,node-inspector,JavaScript,Google Chrome:debugging工作stream程
- 为什么node.js运行时比Google Chrome控制台慢
- 使用来自NodeJs的WebAudio API
- 有没有办法正则expression式引用Node.js中的string?
- setTimeout(func,0)`和`setTimeout(func,1)`是否一样?
- Google Chrome中的videosearch:如何处理连续的部分内容请求?