541

What's the difference between ECMAScript and JavaScript? From what I've deduced, ECMAScript is the standard and JavaScript is the implementation. Is this correct?

Cole Tobin
  • 9,206
  • 15
  • 49
  • 74
Guy
  • 65,082
  • 97
  • 254
  • 325

15 Answers15

701

I think a little history lesson is due.

JavaScript was originally named Mocha and changed to Livescript but ultimately became JavaScript.

It's important to note that JavaScript came before ECMAscript and the history will tell you why.

To start from the beginning, JavaScript derived its name from Java and initially Brendan Eich (the creator of JS) was asked to develop a language that resembled Java for the web for Netscape.

Eich, however decided that Java was too complicated with all its rules and so set out to create a simpler language that even a beginner could code in. This is evident in such things like the relaxing of the need to have a semicolon.

After the language was complete, the marketing team of Netscape requested Sun to allow them to name it JavaScript as a marketing stunt and hence why most people who have never used JavaScript think it's related to Java.

About a year or two after JavaScript's release in the browser, Microsoft's IE took the language and started making its own implementations such as JScript. At the same time, IE was dominating the market and not long after Netscape had to shut its project.

Before Netscape went down, they decided to start a standard that would guide the path of JavaScript, named ECMAScript.

ECMAScript had a few releases and in 1999 they released their last version (ECMAScript 3) before they went into hibernation for the next 10 years. During this 10 years, Microsoft dominated the scenes but at the same time they weren't improving their product and hence Firefox was born (led by Eich) and a whole heap of other browsers such as Chrome, Opera.

ECMAScript released its 5th Edition in 2009 (the 4th edition was abandoned) with features such as strict mode. Since then, ECMAScript has gained a lot of momentum and is scheduled to release its 6th Edition in a few months from now with the biggest changes its had thus far.

You can use a list of features for ECMAScript 6 here http://kangax.github.io/es5-compat-table/es6/ and also the browser support. You can even start writing Ecmascript 6 like you do with CoffeeScript and use a compiler to compile down to Ecmascript 5.

Whether ECMAScript is the language and JavaScript is a dialect is arguable, but not important. If you continue to think like this it might confuse you. There is no compiler out there that would run ECMAScript, and I believe JavaScript is considered the Language which implements a standard called ECMAScript.

There are also other noticeable languages that implement ECMAScript such as ActionScript (used for Flash)

yangli-io
  • 16,760
  • 8
  • 37
  • 47
  • 1
    For those interested in how to compile/transpile the new ES2015 standard down to ECMAScript 5 code, you will want to check out Babel (formerly 6to5) available at https://babeljs.io/ or traceur at https://github.com/google/traceur-compiler. With these tools available, there is no reason you can't start writing "new JavaScript" right now, and take advantage of all the latest additions to the language. – LWurm Nov 01 '15 at 00:04
  • 1
    I was not aware that Lua implements ECMAScript. I can't seem to find anything that corroborates that. What is your source? – battmanz Jan 14 '16 at 15:58
  • @battmanz I think I must of heard this somewhere, but you're right I can't seem to find anything related to this. Thanks for pointing this out. – yangli-io Jan 14 '16 at 23:11
  • 3
    @YangLi Do you agree with jerone's answer below, that the ECMAScript languages do not include the DOM API that we all use when writing pure JavaScript? – john_science Nov 29 '16 at 00:05
  • 19
    @theJollySin Yep, he's correct. ECMAScript wasn't designed specifically for the browser so methods like document.getElementById and other DOM APIs aren't part of the standard. They belong to the WHATWG standards, along with some other browser specific method like localStorage etc. If you take node and dont use any imported modules then you have the ECMAScript only API. – yangli-io Nov 29 '16 at 01:30
  • 3
    How can multiple languages implement the same standard and not be the same language? The standard *defines* the language. If some language implements the C++ standard, it is called C++, not something else (exactly *because* it implements that standard). So I still have the same question... what's the difference? – Neme Jan 26 '18 at 11:11
  • 1
    Methods like `document.getElementById` are *not* part of the language, that's an API. – Neme Jan 26 '18 at 11:13
  • 1
    (Sorry just the questions to make it compact) How JScript from MS was different from JavaScript of the day? Why they decided to go to ECMA and not anywhere else (IEEE, whatever)? Was the ECMA standard more aligned with MS variant or more wilth Netscape? It would be great to update the core answer. – Kirill Kobelev Nov 05 '19 at 14:16
  • @YangLi - There are courses on plain JS and ES6 JS. Which one should we take ? Is The ES6 one used more in professional settings ? Thanks. – MasterJoe Apr 02 '20 at 18:14
  • Worth mentioning Douglas Crockford has some nice talks up on YouTube that go into much more detail about the history of JavaScript. – mdcq Apr 06 '21 at 21:34
  • 1
    @MasterJoe ES6 for sure, you'll hardly find people using plain JS these days – yangli-io May 20 '21 at 02:51
  • @Neme a language "X" is a map between symbols and instructions. Another language "Y" can have all the same maps as X, *plus* additional ones. X then is not only a specific language ("just X") but also a specification for languages ("X with extra stuff"), of which Y is an example. Language is exclusive, Specification is inclusive – Juan Perez Jun 27 '23 at 03:38
197

ECMAScript is the language, whereas JavaScript, JScript, and even ActionScript 3 are called "dialects". Wikipedia sheds some light on this.

Cole Tobin
  • 9,206
  • 15
  • 49
  • 74
Ryan Florence
  • 13,361
  • 9
  • 46
  • 63
  • 10
    what would be really nice is a clear mapping between JavaScript and ECMAScript versions, e.g. ES5 corresponds to JS1.5 etc. ah I found it: http://en.wikipedia.org/wiki/JavaScript#Versions – Sam Joseph Oct 06 '12 at 17:35
  • 3
    @Sam -- update of Sam's link: https://en.wikipedia.org/wiki/JavaScript#Version_history – Rop Oct 17 '15 at 22:53
  • 82
    Downvoted and upvoted Yang Li's, as this answer says very little and basically points you to Wikipedia. The answer by Yang Li is much more detailed and useful. Also, whether one is the language/standard and other the dialect, or implementation etc is open to opinion, and not fact, from what I understand. Whereas this answer makes it appear that it is fact. Correct me if I am wrong. In fact, I would argue that the suggestion by this answer is not even the popular consensus. As most see ECMAScript has the standard and JavaScript as the language. – redfox05 Nov 02 '15 at 16:47
  • 2
    @Rop - Update to that link: https://en.wikipedia.org/wiki/ECMAScript#Version_correspondence – Dave Sep 01 '16 at 21:16
  • 1
    @HDave - Yet another update to that link: https://en.wikipedia.org/wiki/JavaScript#Version_history – Peter Gibbons Jun 28 '18 at 19:24
  • 9
    I disagree. ECMAScript is the specification. JS, JScript, ActionScript are languages that implement such specification. – adripanico Jan 22 '19 at 15:02
188

ECMAScript = ES:

  • ECMAScript is a Standard for 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

JavaScript = JS:

  • JavaScript is the most popular implementation 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 other languages that implement 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.

ES5 = ECMAScript 5:

  • ES5 is a version of the ECMAScript (old/current one).

  • ES5 is the JavaScript you know and use in the browser today.

  • ES5 does not require a build step (transpilers) to transform it into something that will run in today's browsers.

  • ECMAScript version 5 was finished in December 2009,  the latest versions of all major browsers (Chrome, Safari, Firefox, and IE)  have implemented version 5.

  • Version 5.1 was finished in June, 2011.

ES6 = ECMAScript 6 = ES2015 = ECMAScript 2015:

  • ES2015 is a version of the ECMAScript (new/future one).

  • Officially the name ES2015 should be used instead of ES6.

  • ES6 will tackle many of the core language shortcomings addressed in  TypeScript and CoffeeScript.

  • ES6 is the next iteration of JavaScript, but it does not run in today's browsers.

  • There are quite a few transpilers that will export ES5 for running in browsers.

BabelJS:

  • BabelJS is the most popular transpiler that transforms new JavaScript ES6 to Old JavaScript ES5.

  • BabelJS makes it possible for writing the next generation of JavaScript today (means ES2015).

  • BabelJS simply takes ES2015 file and transform it into ES5 file.

  • Current browsers versions can now understand the new JavaScript code (ES2015), even if they don't yet support it.

TypeScript and CoffeeScript:

  • Both provides syntactic sugar on top of ES5  and then are transcompiled into ES5 compliant JavaScript. 

  • You write TypeScript or CoffeeScript then the transpiler transforms it into ES5 JavaScript.

Josh Wright
  • 118
  • 12
Mahmoud Zalt
  • 30,478
  • 7
  • 87
  • 83
  • 3
    "*Javascript also has other additional features that are not in the ECMA specifications/standard*" Could you please give some examples to those features? – Aruna Herath Nov 16 '16 at 16:46
  • 1
    "_JavaScript is the most popular implementations of the ECMAScript Standard._" Then where can I find the source of this implementation called 'JavaScript'? – bzeaman Jan 31 '17 at 12:19
  • 1
    @bzeaman - I'm not 100% clear on what you're asking for. You can find a list of JavaScript engines on Wikipedia. If you're looking for language specifications, look on the Mozilla Developer Network, under "JavaScript language resources", for ECMAScript docs. If you're looking for a JavaScript API reference, check Mozilla Developer Network or w3schools. Consider opening a new question if these don't meet your needs. :) – Corrodias Feb 21 '17 at 20:37
  • 9
    With my question I'm trying to point out a potential incorrectness in the wording of the answer. The word 'implementation' is used. JavaScript is said to be 'the most popular **implementation**'. An implementation is a '**realization** of a technical specification'. Which translates into **software**. So then I wonder where this software called 'JavaScript' is. – bzeaman Feb 22 '17 at 19:43
  • 2
    @bzeaman - This feels like nit picking. That may be the jargon definition of implementation, but colloquially, it fits here. Nevertheless, please suggest a more appropriate term. – Corrodias Feb 25 '17 at 05:12
  • 6
    @Corrodias I would agree it feels like nit picking, but I think it's sensible to do when the answer is about defining things. JavaScript is a language, nowadays standardized by ECMAscript comparable to how C is a language which is standardized by ISO standards. A term for JavaScript would then simply be 'language', nothing more. – bzeaman Feb 25 '17 at 09:54
  • 5
    The summaries of ES5, ES2015 and BabelJS really clears the air on lot of confusions one might have when he lands in today's JS scripting world from server side programming. Great answer. +1 – RBT Aug 01 '17 at 10:49
  • 2
    `JavaScript = ECMAScript + DOM API;`. Does it mean `Server Side JS = ECMAScript`? @Corrodias What you say, is that correct? – Radix Jan 01 '18 at 22:28
  • @Atul Khanduri - That seems like a reasonable conclusion, but I don't have the experience with JS outside of a browser to say with any authority whether that's right or wrong. – Corrodias Jan 04 '18 at 11:02
  • Extremely helpful to just put this up in a bunch of bullet points. Clarifies a lot. Thank you! – Teekin Jul 13 '19 at 21:53
  • @bzeaman everything is a specification in addition to its other types. A software is also a specification for that software, and others that are the same but also have additional features. A language is also a specification for that language, and supertypes of it. An "implementation" of a specification is simply another specification that is *even more specific*. – Juan Perez Jun 27 '23 at 03:51
67

The umbrella term:

JavaScript = ECMAScript + DOM + BOM;

  • ECMAScript® Language Specification defines all logic for creating and editing objects, arrays, numbers, etc...

  • DOM (Document Object Model) makes it possible to communicate with HTML/XML documents (e.g. document.getElementById('id');).

  • BOM (Browser Object Model) is the hierarchy of browser objects (e.g. location object, history object, form elements).

History of JavaScript naming:

Mocha ► LiveScript ► JavaScript (the language) ► (part of JS resulted in) ECMA-262 ► ECMAScript ► JavaScript (umbrella term, consisting of ECMAScript + DOM + BOM)

jerone
  • 16,206
  • 4
  • 39
  • 57
  • 12
    So what's in node.js is not JavaScript? Because it doesn't have the DOM API. – Aruna Herath Nov 16 '16 at 16:42
  • 8
    That's correct. _"Node.js is built against modern versions of V8."_ & _"V8 implements ECMAScript as specified in ECMA-262, 5th edition..."_ & _"The DOM is not, however, typically provided by the JavaScript engine but instead by a browser. The same is true of V8—Google Chrome provides the DOM."_ (Source: https://nodejs.org/en/docs/es6/ & https://github.com/v8/v8/wiki/Introduction) – jerone Nov 17 '16 at 15:25
  • 7
    @jerone What *version* of ECMAScript am I using when I write JavaScript code? Does it vary by browser or library? – john_science Nov 29 '16 at 05:15
  • 1
    @theJollySin ECMAScript is ran by browsers (or engines to be more precise). As a browser-user you won't notice a thing about it. As a developer however, you can take advantaged of features part of the ECMAScript specification. You can see here which features are supported by which engines: http://kangax.github.io/compat-table/ – jerone May 15 '17 at 11:13
  • 5
    Can you give a reference to `JavaScript = ECMAScript + DOM API;`? – Koray Tugay May 11 '18 at 15:36
  • 2
    @koray-tugay Except here, there is not much documentation about what JavaScript exactly is. I guess that's why this question is so popular. The "formula" `JavaScript = ECMAScript + DOM API;` is just based on the overall agreed upon documented terms JavaScript consists of. – jerone May 12 '18 at 19:16
  • 1
    _“ECMAScript ► JavaScript (consists of ECMAScript + DOM + BOM)”_ is not part of the naming history. The specification is still called ECMAScript or ECMA-262. The language based on this specification which includes various Web APIs (or other APIs depending on host environment) is called JavaScript. – Sebastian Simon Aug 22 '20 at 10:07
44

Technically ECMAScript is the language that everyone is using and implementing -- it is the specification created many years ago when Netscape and Microsoft sat down and attempted to standardise the scripting between JavaScript (Netscape's scripting language) and JScript (Microsoft's).

Subsequently all these engines are ostensibly implementing ECMAScript, however JavaScript (the name) now hangs around for both traditional naming reasons, and as a marketing term by Mozilla for their various non-standard extensions (which they want to be able to actually "version")

Xplora
  • 837
  • 3
  • 12
  • 24
olliej
  • 35,755
  • 9
  • 58
  • 55
18

Various JavaScript versions are implementations of the ECMAScript standard.

canen
  • 1,590
  • 9
  • 6
12

In my understanding, ECMAScript is the "Theory" or "Specification", and Javascript is "Practicals" or "Implementation".

Rethna
  • 221
  • 1
  • 3
  • 9
11

i know this is an old post but hopefully this will help someone.

In the 1990’s different versions of js started coming out like javascript from netscape, Js script from Microsoft. So ecmascript was introduced as a standard. But ecmascript forms only a part of javascript which specifies its core syntax,types,objects etc. Probably that explains the inconsistent implementations of javascript across diff. browsers

Reference - Wrox(Professional Javascript For Web Developers)

depz123
  • 497
  • 5
  • 18
10

Here are my findings:

JavaScript: The Definitive Guide, written by David Flanagan provides a very concise explanation:

JavaScript was created at Netscape in the early days of the Web, and technically, "JavaScript" is a trademark licensed from Sun Microsystems (now Oracle) used to describe Netscape's (now Mozilla's) implementation of the language. Netscape submitted the language for standardization to ECMA and because of trademark issues, the standardized version of the language was stuck with the awkward name "ECMAScript". For the same trademark reasons, Microsoft's version of the language is formally known as "JScript". In practice, just about everyone calls the language JavaScript.

A blog post by Microsoft seems to agree with what Flanagan explains by saying..

ECMAScript is the official name for the JavaScript language we all know and love.

.. which makes me think all occurrences of JavaScript in this reference post (by Microsoft again) must be replaced by ECMASCript. They actually seem to be careful with using ECMAScript only in this, more recent and more technical documentation page.

w3schools.com seems to agree with the definitions above:

JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997. ECMA-262 is the official name of the standard. ECMAScript is the official name of the language.

The key here is: the official name of the language.

If you check Mozilla 's JavaScript version pages, you will encounter the following statement:

Deprecated. The explicit versioning and opt-in of language features was Mozilla-specific and are in process of being removed. Firefox 4 was the last version which referred to a JavaScript version (1.8.5). With new ECMA standards, JavaScript language features are now often mentioned with their initial definition in ECMA-262 Editions such as ECMAScript 2015.

and when you see the recent release notes, you will always see reference to ECMAScript standards, such as:

  • The ES2015 Symbol.toStringTag property has been implemented (bug 1114580).

  • The ES2015 TypedArray.prototype.toString() and TypedArray.prototype.toLocaleString() methods have been implemented (bug 1121938).

Mozilla Web Docs also has a page that explains the difference between ECMAScript and JavaScript:

However, the umbrella term "JavaScript" as understood in a web browser context contains several very different elements. One of them is the core language (ECMAScript), another is the collection of the Web APIs, including the DOM (Document Object Model).

Conclusion

To my understanding, people use the word JavaScript somewhat liberally to refer to the core ECMAScript specification.

I would say, all the modern JavaScript implementations (or JavaScript Engines) are in fact ECMAScript implementations. Check the definition of the V8 Engine from Google, for example:

V8 is Google’s open source high-performance JavaScript engine, written in C++ and used in Google Chrome, the open source browser from Google, and in Node.js, among others. It implements ECMAScript as specified in ECMA-262.

They seem to use the word JavaScript and ECMAScript interchangeably, and I would say it is actually an ECMAScript engine?

So most JavaScript Engines are actually implementing the ECMAScript standard, but instead of calling them ECMAScript engines, they call themselves JavaScript Engines. This answer also supports the way I see the situation.

Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
10

JavaScript is a ECMAScript language.

ECMAScript isn't necessarily JavaScript.

jerone
  • 16,206
  • 4
  • 39
  • 57
ryansstack
  • 1,396
  • 1
  • 15
  • 33
8

Existing answers paraphrase the main point quite well.

The main point is that ECMAScript is the bare abstract language, without any domain specific extensions, it's useless in itself. The specification defines only the language and the core objects of it.

While JavaScript and ActionScript and other dialects add the domain specific library to it, so you can use it for something meaningful.

There are many ECMAScript engines, some of them are open source, others are proprietary. You can link them into your program then add your native functions to the global object so your program becomes scriptable. Although most often they are used in browsers.

Calmarius
  • 18,570
  • 18
  • 110
  • 157
7

ECMAScript is a standard for JavaScript, look at these statements from MDN:

enter image description here

JavaScript

JavaScript (JS) is a lightweight interpreted or JIT-compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript.


ECMAScript

The standard for JavaScript is ECMAScript. As of 2012, all modern browsers fully support ECMAScript 5.1. Older browsers support at least ECMAScript 3. On June 17, 2015, ECMA International published the sixth major version of ECMAScript, which is officially called ECMAScript 2015, and was initially referred to as ECMAScript 6 or ES6. Since then, ECMAScript standards are on yearly release cycles. This documentation refers to the latest draft version, which is currently ECMAScript 2018.

For more info, visit here

Alireza
  • 100,211
  • 27
  • 269
  • 172
5

Javascript was the original name, meant to capitalize on the popularity of java. ECMA is the standards body that oversees the standard that was eventually put in place so the names are roughly equivalent.

Implementations have other names, like V8 or Rhino, etc.

Jeremy Huiskamp
  • 5,186
  • 5
  • 26
  • 19
3

I doubt we'd ever use the word "ECMAScript" if not for the fact that the name "JavaScript" is owned by Sun. For all intents and purposes, the language is JavaScript. You don't go to the bookstore looking for ECMAScript books, do you?

It's a bit too simple to say that "JavaScript" is the implementation. JScript is Microsoft's implementation.

Nosredna
  • 83,000
  • 15
  • 95
  • 122
  • 2
    I don't have a problem with the word ECMAscript... have you ever thought it's weird to say MPEG, instead of video? – ryansstack May 26 '09 at 20:47
  • 8
    Haha. Wasn't it Brendan Eich who said ECMAScript sounded like a skin disease? :-) – Nosredna May 26 '09 at 21:50
  • 7
    Sun owns the word Java, not JavaScript. – James R. Clayton May 29 '14 at 15:05
  • 2
    @JamesR.Clayton JavaScript was created at Netscape in the early days of the Web, and technically, “JavaScript” is a trademark licensed from Sun Microsystems (now Oracle) used to describe Netscape’s (now Mozilla’s) implementation of the language. – Koray Tugay May 11 '18 at 20:10
1

JavaScript is one branch of languages formed around the ECMAScript standard. I believe ECMA is the European Computer Manufacturers Association, not that this is really relevant or anything.

Don't forget another popular language formed around the ECMA Script standard is ActionScript, used in Adobe Flash/Flex.

JAL
  • 21,295
  • 1
  • 48
  • 66