Javascript is a bit confusing right now.
On one hand you have the Javascript language that you can use directly in the browser, simply drop it in the console and everything runs as expected.
On the other hand you have this new and improved Javascript often referred to asES2015
or ES6
that has hundreds of new features and looks a lot like a whole new language; so whats the deal?
Edit: As Mikael Brevik pointed outES6
was the original name for ES2015
before they switched to the yearly naming convention.
Well believe it or not, this has been going on for a while. The Javascript you can use in the browser today is constantly changing and is actually just an implementation of a standard called ECMAScript
(http://www.ecma-international.org).
The term ES2015
simply refer to a specific version of that standard.
You can view them here.
ES2015
orES6
— http://www.ecma-international.org/ecma-262/6.0/ES2016
— https://www.ecma-international.org/ecma-262/7.0/
You can also view the proposals below which will eventually become ES2017
.
- Current Proposals: https://github.com/tc39/proposals
Naturally these standards are adopted over a period of time, while slowly being integrated into the various JavaScript engines. You can view the current status of these implementations here (http://kangax.github.io/compat-table/es5/).
As a developer, these new standards can completely transform your code and you want to use all the latest and greatest features, but keep track of all the various standards and implementations is a huge amount of work…
So whats one to do?
In short Babel (https://babeljs.io/). Babel is a project dedicated to filling the gaps between the new ECMA Script features and the current JavaScript implementations.
This means that you can use all the new ECMA features without having to worry about which JavaScript implementations support it.
Simply input your snazzy new ES2017
JavaScript code and out pops a cross browser/node compliant JavaScript that you can run across the board!
So how do you take advantage of this wonderful Babel tool?
Well you can either check out the docs http://babeljs.io/docs/setup/…
Or follow me for the next installment of this series where I will show you exactly how to take advantage of babel for all you JavaScript projects : )
Edit : part 2 Babel.js , A whole new JavaScript is over here
Talk to you soon!
Alex