Javascript 和 ECMA 脚本有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4271676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between Javascript and ECMA script?
提问by Exitos
What would happen if I start to define my script tags as ECMA? Will it execute to a different standard?
如果我开始将脚本标签定义为 ECMA,会发生什么?它会按照不同的标准执行吗?
Does anyone actually use ECMA script instead of straight up Javascript...?
有没有人真的使用 ECMA 脚本而不是直接使用 Javascript ......?
回答by Alin Purcaru
ECMAScript is a standard. JavaScript is an implementation of that standard (edition 3 of that standard to be more exact).
ECMAScript 是一个标准。JavaScript 是该标准的实现(更准确地说是该标准的第 3 版)。
Other implementations of ECMAScript are ActionScript and JScript.
ECMAScript 的其他实现是 ActionScript 和 JScript。
Also note that there isn't one JavaScript. Each JavaScript engine may implement its own version of the language as long as it meets the ECMAScript requirements. This means that browsers (JS engines) mayhave additional functionality, but they all musthave the base ECMAScript functionality.
另请注意,没有一个 JavaScript。只要满足 ECMAScript 要求,每个 JavaScript 引擎都可以实现自己的语言版本。这意味着浏览器(JS 引擎)可能具有附加功能,但它们都必须具有基本的 ECMAScript 功能。
And now, to answer your question, according to RFC 4329, if the media type is set to application/ecmascript, rather than application/javascript, it must adhere to a stricter standard.
现在,要回答您的问题,根据RFC 4329,如果媒体类型设置为application/ecmascript,而不是application/javascript,则它必须遵守更严格的标准。
This document defines equivalent processing requirements for the types text/javascript, text/ecmascript, and application/javascript. Use of and support for the media type application/ecmascript is considerably less widespread than for other media types defined in this document. Using that to its advantage, this document defines stricter processing rules for this type to foster more interoperable processing.
本文档定义了 text/javascript、text/ecmascript 和 application/javascript 类型的等效处理要求。媒体类型应用程序/ecmascript 的使用和支持远不如本文档中定义的其他媒体类型广泛。充分利用这一点,本文档为此类型定义了更严格的处理规则,以促进更具互操作性的处理。
回答by rtpg
ECMAScript is a programming language standard, like lisp. Javascript is an implementation of such, along with non-ECMAScript features like the DOM. ActionScript(for Flash) is another one. Just like writing in "lisp" means writing in some dialect like Common Lisp or Scheme, actually writing straight-up ECMAScript might not only be pointless, but unusable in the dialects(although I think ActionScript 3 and recent JavaScript apply the whole ECMAScript standard).
ECMAScript 是一种编程语言标准,就像 lisp。Javascript 是此类的实现,以及 DOM 等非 ECMAScript 功能。ActionScript(for Flash) 是另一个。就像用“lisp”写意味着用像 Common Lisp 或 Scheme 这样的方言写一样,实际上直接写 ECMAScript 不仅没有意义,而且在方言中无法使用(虽然我认为 ActionScript 3 和最近的 JavaScript 应用了整个 ECMAScript 标准) .

