December 5-7, 2016
Vancouver, Canada

Blog: Ben Ilegbodu on ES6

Ben Ilegbodu on ES6

We interviewed Ben Ilegbodu, who is one of our speakers at ConFoo Vancouver 2016. His presentation is titled “Sweet ES6”. Ben is a senior UI engineer at Eventbrite with more than ten years of web development experience. He lives in San Francisco.

What is ES6?

Officially named ES2015, ES6 is the 6th edition of the ECMAScript specification for JavaScript, which was released in August 2015. It's packed with over 30 new features split into two groups: syntactic sugar and new functionality.

What advantages does ES6 offer over the previous version of JavaScript?

JavaScript is fully backwards compatible, so ES6 is a superset of ES5 (released way back in December 2009). The new syntactic sugar features, like destructuring or the spread operator, enable developers to write clearer, more concise code. Some of the new functionality, on the other hand, actually enable us to develop in ways that just were not possible with ES5. The best part of the new ES2015 features is that they eliminate most of the tricks/hacks/workarounds JavaScript developers employed to do seemingly simple things.

Is ES6 supported on all major browsers?

Yes! All modern browsers, like Chrome, Firefox and Edge, support the vast majority of ES6 features. The latest version of Node also has full ES6 support. However, depending on your user base, you may still need to support very old versions of Internet Explorer, none of which have ES2015 support.

With the help of transpilers like Babel and TypeScript, we can use ES2015 syntactic sugar features today in browsers that don’t support them. We can write ES6 code, and “compile” it down to ES5 so it can work in all environments. There are also shims and polyfills so that we can use the new functionality as well. The ECMAScript 6 compatibility table keeps track of ES6 support in all JavaScript interpreters and transpilers.

Is it difficult to learn for JavaScript developers?

Interestingly enough, I've found that non JavaScript developers, like those who develop primarily in Python or Ruby, pick up the ES6 syntactic sugar features even more quickly than existing JavaScript developers. I think it's because, in many respects, JavaScript is playing catch-up with the functionality existing in other popular programming languages. So these non-JavaScript developers are able to quickly find parallels in their favorite languages.

But in general, I don't think ES2015 is too difficult for JavaScript developers to learn. The JavaScript syntax hasn't changed much since ES3 was introduced last century in 1999, so JavaScript developers have just become familiar with the status quo. When I first saw destructuring, for instance, it felt like a completely different language. But as with anything new we learn, with practice and repetition, it's now become natural and second nature. I’m actually upset when I have to develop in certain old environments that don’t allow for me to leverage ES6.

What would be the top reason that you would give companies to start using ES6?

JavaScript is continuously evolving. The ES2016 specification is releasing this month (with only two features), and there are dozens of proposals already in the works for future releases. If companies don’t start adopting ES6 now, they run the risk of technologically falling behind, which will make it that much harder to keep up and continue to attract quality talent.

As I mentioned, JavaScript is always fully backwards compatible in order to not break the web, so there’s no massive “upgrade” that you sometimes have with other programming languages. The new functionality is totally opt-in, so your team can start with a couple of features at first and progressively leverage more and more. The hardest part all of it is setting up the transpilation from ES6 to ES5, but almost every company already has some sort of build process, so this would just be another step in it. You can do it!

Don't forget to register for your nearest ConFoo conference and follow us on Twitter for more blog posts.

Vancouver 2016 sponsored by