开发者

What is the difference between Javascript and ECMA script? [duplicate]

开发者 https://www.devze.com 2023-01-27 07:58 出处:网络
This question already has answers here: What is the difference between JavaScript and ECMAScript? (15 answers)
This question already has answers here: What is the difference between JavaScript and ECMAScript? (15 answers) Closed 8 years 开发者_运维技巧ago.

What would happen if I start to define my script tags as ECMA? Will it execute to a different standard?

Does anyone actually use ECMA script instead of straight up Javascript...?


ECMAScript is a standard. JavaScript is an implementation of that standard (edition 3 of that standard to be more exact).

Other implementations of ECMAScript are ActionScript and 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) may have additional functionality, but they all must have the base ECMAScript functionality.

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.

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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消