What is the difference between JavaScript and ECMAScript?
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?
Solution 1:
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)
Solution 2:
ECMAScript is the language, whereas JavaScript, JScript, and even ActionScript 3 are called "dialects". Wikipedia sheds some light on this.
Solution 3:
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.
Solution 4:
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 ► (part of JS resulted in) ECMA-262 ► ECMAScript ► JavaScript (consists of ECMAScript + DOM + BOM)
Solution 5:
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")