Future of JavaScript – A Look at ECMAScript 6
This tutorial series will take a look at the future of JavaScript. It will take an in-depth look at ECMAScript 6 (ECMAScript 2015), the latest version of the standard for JavaScript. Throughout the series, you will learn about new language features and what you can build with them. You are expected to have an understanding of JavaScript.
Level: Intermediate to Advanced.
Part 1 - Welcoming ECMAScript 6
Welcome to the first part of the Future of JavaScript tutorial series. We will be discussing what ECMAScript is, why you should care and where we are right now.
What is ECMAScript? What is ECMAScript 6 or ECMAScript 2015 or Harmony or JavaScript 2015?
ECMAScript is the scripting language standardized by ECMA International as ECMA-262. ECMA International is a standards setting organization. This organization the very difficult task of setting the standards for JavaScript implementations. For those curious, ECMAScript implementations also include JScript and ActionScript. However, ECMAScript is chiefly the basis for client-side scripting on the Web a.k.a. JavaScript.
The ECMAScript standard has gone through several editions. The latest ECMAScript standard, Edition 6, has been finalized. You may have heard it called ES6, ECMAScript 2015, Harmony or even JavaScript 2015. All those nicknames refer to the 6th edition of ECMAScript.
ES6 is a significant update to the language and includes numerous new language features. As we speak, major JavaScript engines are implementing features with several already available in most JavaScript engines.
Why you should care?
JavaScript is everywhere! It’s being used as the development language everywhere from IoT devices to mobile apps to databases to front-end and backend web technologies. Any changes to the ECMAScript standard a.k.a. JavaScript will undoubtedly have profound effects on multiple different technologies. JavaScript is everywhere, and you should care!
Where are we now?
Most browsers and JavaScript engines have already implemented features that have been in the draft standard of ES6 for a while. You’ll find a very detailed status table on Kangax and a detailed ES6 Matrix by Thomas Lahn. Microsoft Edge fares very well in supporting most ES6 features.
How to get ES6?
If you want to try ES6 in your browser, you have to turn it on as ES6 support is still considered experimental.
- For Microsoft Edge on Windows 10:
- Enable “Experimental JavaScript features” flag
- For Chrome Canary:
- Go to chrome://flags & turn on “Enable Experimental JavaScript”
- Or you can try the Firefox Nightly or Firefox Developer Edition
You can also try ES6 in Node.js or io.js, you just need to use --v8-options flag ONLY IF YOU'RE IN NODE <4.0.
node --v8-options | grep harmony
--harmony_typeof #(enable harmony semantics for typeof)
--harmony_scoping #(enable harmony block scoping)
--harmony_modules #(enable harmony modules (implies block scoping))
--harmony_proxies #(enable harmony proxies)
--harmony_collections #(enable harmony collections (sets, maps, and weak maps))
--harmony #(enable all harmony features (except typeof))
What's Next?
In the next parts of this tutorial series, I will be discussing different language features such as classes & modules, generators & iterators, block scoping, arrows, and more. I will also be sharing strategies for how best to manage a transition to ES6 either through transcompilation or using shims for different features. Stay tuned for the next edition!