134

In Visual Studio when I am setting my script type to JavaScript this comes up as an option in intellisense.

A quick Google search came up with lame results, leading me to believe this isn't terribly popular to use.

  • What is it?
  • Does anyone use it? (<script type="text/ecmascript">)
  • Why?
morkro
  • 4,336
  • 5
  • 25
  • 35
Jason
  • 11,435
  • 24
  • 77
  • 131
  • 2
    **Related**: [type="text/ecmascript" vs type="text/javascript"](http://stackoverflow.com/q/23370892/1497596) – DavidRR Nov 12 '14 at 14:59
  • Knowing the [difference between ECMAScript and Javascript](https://stackoverflow.com/q/912479/465053) also helps understanding ECMAScript. – RBT Aug 01 '17 at 05:26

6 Answers6

186

JavaScript is a subset of ECMAScript. JavaScript is basically ECMAScript at its core but builds upon it. Languages such as ActionScript, JavaScript, JScript all use ECMAScript as its core. As a comparison, AS/JS/JScript are 3 different cars, but they all use the same engine... each of their exteriors is different though, and there have been several modifications done to each to make it unique.

The history is, Brendan Eich created Mocha which became LiveScript, and later JavaScript. Netscape presented JavaScript to Ecma International, which develops standards and it was renamed to ECMA-262 aka ECMAScript.

It's important to note that Brendan Eich's "JavaScript" is not the same JavaScript that is a dialect of ECMAScript. He built the core language which was renamed to ECMAScript, which differs from the JavaScript which browser-vendors implement nowadays.

http://en.wikipedia.org/wiki/ECMAScript

ConfusedDeer
  • 3,335
  • 8
  • 44
  • 72
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
  • 35
    Doesn't that make Javascript a subset of ECMAScript, if ECMAScript is the core? – Ryan Amos Jul 20 '11 at 15:38
  • 16
    JavaScript (historically) has things ECMAScript doesn't. JavaScript (historically tries to) have everything ECMAScript has. Therefore the post is correct, ECMAScript is a subset of JavaScript. However, both are kept pretty close to each other (while ActionScript is no longer really considered an ECMAScript language it has diverged so much, although it did have its roots in it). The terms ES and JS are almost interchangeable. – Nathan Wall Oct 31 '12 at 14:28
  • 24
    I don't think it is accurate to say that *"ECMAScript is a subset of JavaScript."* Instead, the Wikipedia article you cite indicates that ECMAScript is a **standard** and that JavaScript is a well-known **implementation** of that standard [(with extensions)](http://en.wikipedia.org/wiki/ECMAScript#Implementations). – DavidRR Nov 12 '14 at 15:16
  • Yes, but what version of ES are is used nowadays in Browsers? ES3 or ES6 (the latest one)? – prosti Sep 08 '16 at 20:24
  • 3
    I think you meant to say `ECMAScript is a superset of Javascript` – Callat May 25 '17 at 12:47
  • 10
    Because Javascript implements ECMAScript and also build on top of it, I would say Javascript is therefor a superset of ECMAScript. – RayLoveless Jul 14 '17 at 19:27
  • Love the car analogy. – RayLoveless Jul 14 '17 at 19:27
  • A language is a set - the set of strings which are valid programs in that language. With that definition any ECMAScript program is also a JavaScript program, making ECMAScript a subset of JavaScript. – Aviad P. Aug 12 '17 at 11:14
  • Comments are confusing me that which one is the subset and which one is the superset :/ – AliN11 Jun 17 '20 at 11:03
89

ECMAScript is a standard. JavaScript and ActionScript are well-known implementations of the ECMAScript standard.

http://en.wikipedia.org/wiki/ECMAScript

DavidRR
  • 18,291
  • 25
  • 109
  • 191
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
40

ECMAScript = ES:

  • ECMAScript is a Standard for a scripting languages.

  • Languages like Javascript are based on the ECMAScript standard.

  • ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft).

  • ECMA means European Computer Manufacturer’s Association


On the other side:


JavaScript = JS:

  • JavaScript is the most popular implementations of the ECMAScript Standard.

  • The core features of Javascript are based on the ECMAScript standard,  but Javascript also has other additional features that are not in the ECMA specifications/standard.

  • ActionScript and JScript are another languages that implements the ECMAScript.

  • JavaScript was submitted to ECMA for standardization but due to trademark issues with the name Javascript the standard became called ECMAScript.

  • Every browser has a JavaScript interpreter.


For more details on this checkout my full answer here What is the difference between JavaScript and ECMAScript?

Community
  • 1
  • 1
Mahmoud Zalt
  • 30,478
  • 7
  • 87
  • 83
  • almost every browser has JavaScript support, but there are a lot of CLI browsers like links and lynx that don't, beside these there are: links2, w3m, elinks and edbrowse. The majority of CLI browsers don't support JS as well. – Cassio Seffrin Mar 11 '20 at 03:37
16

ECMA stands for - European Computer Manufacturer's Association. ECMAScript is a standard for a scripting language. It specifies the core features that a scripting language should provide and how those features should be implemented. Javascript was originally created at Netscape, and they wanted to standardize the language. So, they submitted the language to the European Computer Manufacturer’s Association (ECMA) for standardization. But, there were trademark issues with the name Javascript, and the standard became called ECMAScript, which is the name it holds today as well.

So you can use any scripting language that implements the ECMA standard as the web browsers support the ECMAScript interpretation when you are specifying (<script type="text/ecmascript">).

Krishna
  • 5,194
  • 2
  • 28
  • 33
2

Here is a different view on this topic. It's more or less from experience, I cannot quote anything. Any JavaScript validator and everybody who works with JavaScript will tell you that

alert("hello World");

is valid JavaScript. And I'd also agree.

However, a ECMAScript validator will probably tell you it is not valid, because alert() is not part of the ECMAScript, but a typically feature of JavaScript for Browsers. There are many features of JavaScript, which make only sense in a browser environment, f.i. window.navigator, window.document, WebSocket, navigator.geolocation. Some would even say, this is not part fo JavaScript, but part of HTML5, which is not true, because HTML5 is just the markup language. However, these fancy new features are often called HTML5, even though they are implemented in JavaScript.

JavaScript can also be used for server side scripting. Then all the geolcation or media apis make no sense. So JavaScript for server side scripting is much closer to ECMAScript again, which doesn't have this typical browser features.

I couldn't really find out, whether the Math object (e.g. Math.sqrt(9)) is part of ECAMScript, or whether ECMAScript really just defines the syntax of the language and has no build in functionality whatsoever. But one ECMAScript validator accepted Math.sqrt(9) as valid ECMAScript, whereas var test=window.document; failed the ECMA validation.

Even though the following link it to a JavaScript documentation, this in my opinion is the build in feature set (objects and functions) of ECMAScript:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

So in my opinion JavaScript is very closely tied to browsers, whereas ECMAScript has really only a very basic set of functionality (if at all).

haferblues
  • 2,155
  • 4
  • 26
  • 39
1

ECMA is the orgranization that standarized JavaScript. They named the language ECMAScript, however the "JavaScript" was the term that won the "name competition"

Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
cateof
  • 6,608
  • 25
  • 79
  • 153