The babel site has a great overview of the features provided as part of 2015. There is also a great series of articles on the Mozilla Hacks blog about ES6 in Depth. Highly recommended if you want to dive deeper on any of the features discussed in this video.
A language by any other name
We're all programmers here, so let's discuss naming.
ES6 expands to ECMAScript 6.
Recently, ECMA decided to move away from major version numbers like 5 and 6, and instead name its versions after the year of their release. Thus, the current version at publication time is ES2015, which was previously and commonly called ES6.
ES6 == ES2015 #=> true
For further reading, you might enjoy this ES-Discuss Discussion around name change to ES2015.
What about Coffeescript?
Until recently, it was a fairly standard thoughtbot practice to use CoffeeScript.
You can read the pull request where we changed our guideline for some good discussion of the topic.
How to use ES6
Since most browsers don't support ES6 directly yet, we use a compiler to convert the code into ES5.
Our preferred compiler for this task is Babel (formerly known as "6to5"). ES6 goes in, ES5 comes out, executable in virtually all browsers.
You can use babel in a Rails app by adding the sprockets-es6 gem.
Tour of features
For more detail on all these features, check out the great tutorial on Babel's Learn ES2015 page.
Scoping w/ let & const
const is a nice tool for preventing a variable from being rebound to a new value.
A nice shorthand for short, (often anonymous) functions.
Default, Rest & Spread
Defining functions with default arguments, rest parameters, and spread (much like Ruby's splat operator).
These features mean there's probably no need to touch the
Destructuring allows binding using pattern matching, with support for matching arrays and objects.
Gone are the days of one giant, global namespace. You can now specify exactly what data/functions you'd like to import or export for each module.
There are many more features in ES6 that we haven't covered here.
If any catch your eye, check them out in Babel's Learn ES2015 tutorial.
- Maps & Sets
Check it out on your next project!