node.js支持哪个版本的Javascript [英] What version of Javascript is supported in node.js
问题描述
我开始使用Node.js并且我很难弄清楚节点支持哪个版本的JavaScript,这使得我很难弄清楚我可以使用哪些功能。这就是我所知道的。
I'm getting started with Node.js and I'm having a hard time figuring out what version of JavaScript is supported by node which makes it difficult figuring out what features I can use. Here's what I know.
- Node 使用V8
- V8 按规定实施ECMAScript在ECMA-262,第3版
- ECMA-262,第3版是 JavaScript 1.5
- Node uses V8
- V8 implements ECMAScript as specified in ECMA-262, 3rd edition
- ECMA-262, 3rd edition is JavaScript 1.5
鉴于此,我认为我可以在节点中使用JavaScript 1.5兼容代码。但是,事实证明我可以使用 数组。 forEach
,以及其他结构,即使根据MDC,它在Javascript 1.6 - ECMA-262,第5版之前不可用。
Given this, I would assume I can use JavaScript 1.5 compatible code in node. However, it turns out I can use the Array.forEach
, among other constructs, even though according to MDC it isn't available until Javascript 1.6 -- ECMA-262, 5th edition.
我哪里错了?是否有某个文档详细说明了可用的语言功能?
Where am I going wrong? Is there a document somewhere that details the available language features?
推荐答案
这个矩阵(V8紧跟WebKit专栏)似乎很好地回答了我可以使用哪些功能?的问题。但是我找不到支持哪个版本的javascript?的规范答案。据我所知,最佳答案是:支持ECMA-262第3版,但也支持第5版的许多功能。
This matrix (V8 follows the WebKit column fairly closely) seems to pretty well answer the question "what features can I use?" but I can't find a canonical answer to "what version of javascript is supported?" As far as I can tell, the best answer is this: ECMA-262 3rd edition is supported, but many features of the 5th edition are also supported.
有一个很好的解释为什么V8遵循此主题。
There's a good explanation of why V8 follows the WebKit and JavaScriptCore functionality on this thread.
这篇关于node.js支持哪个版本的Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!