Introduction to ES6 with Jack Franklin – Codementor Office Hours Q&A
This article is based on the Codementor Office Hours – Introduction to ECMAScript 6, a special session hosted by Jack Franklin. During the Q & A time, Jack had the discussion of ES6 with audiences online. If you had read the series of Introduction to ES6 articles, do not miss this one.
- Part 1: Arrow functions, Classes & Object Literals
- Part 2: Template Strings, Destructuring, Function Arguments & Scope
- Part 3: Modules, Generators, and Using ES6 Today
When Will ES6 become Widespread?
I think this is the first release that I’ve ever been following along with where the tools like Traceur and things have sprung up very quickly and gained popularity very quickly and it shows that a lot of people are really excited about ES6 and the additions it has.
There are so many different features across so many different browsers. I know Google Chrome has implemented a few ES6 features in stable or behind-a-flag versions. They’ve implemented a lot more in their canary version. Similarly I think Firefox is pretty up to date in trying to implement stuff, but there’s still a lot more missing.
I haven’t seen native ES6 module implementation yet. For example, I think Chrome behind-a-flag definitely supports arrow functions. It may even be in stable. This stuff moves so quickly that it’s very hard to keep up with it. However, ES6 modules are definitely not going to be implemented in a couple of months—it’ll probably be more like six or twelve months at least.
Nonetheless, the tools are really keeping up to date so you can certainly use this stuff through tools today. When it comes to ditching those tools and using it on your own natively, we’re still a fair way off from that. But very difficult to predict that kind of thing.
ES6 vs TypeScript
Starting a New Project
What would make you start a project dead set on using ES6?
The only thing would be what kind of browsers I needed to support.
Again, I don’t know this for sure because I’m quite fortunate that at work we get to target quite new browsers, and in all my side projects I never worry about browsers like IE6 for obvious reasons. But I think the thing to check there would be what level of browsers that things like Traceur and Babel support. For example, if they would support down to IE6, then you could use ES6 for all projects.
However, I don’t believe Traceur works in IE6, perhaps not even IE9, I think it might be only 10 and up. All in all, if you’re using Traceur or Babel, or even something like TypeScript or similar, the main problem is what browsers they support with their outputted code.
The Debugging Workflow
Are there any special settings while developing with ES6?
All you need to do is – I believe this will happen by default – make sure you’re working with source maps. I’m pretty sure Traceur and Babel support them.
Personally, I debug all my stuff in Google Chrome and the consoles there are really good at resource maps. For example, if you’ve enabled source maps and you get an error, it will say something like “error line 42” but that actually maps line 20 of your actual code but you can click that and it will take you to the pre-compiled code.
Every now and then there is a problem where you might just have the error and it might point you in the wrong direction, but on the whole source maps gets you ninety-five percent of the way there.
Where to find the latest happenings of ES6
E.g. the progress standards and the roadmaps, things like that?
There’s ES Discuss, which is kind of a forum where a lot of the implementation details of ES6 are discussed in detail by the people leading it. But a lot of that is quite difficult to read. It’s very in-depth, so if you’re not too familiar with the spec, it’s quite difficult to follow.
The main blog I follow on is the blog by Doctor Axel Rauschmayer.
Axel is fantastic at keeping up to date with the spec and stuff. If you look at his ES6 content here, he’s got a ton of posts about the latest specification changes. Once the spec is confirmed he tends to write big posts about the specs. For example, this post is the go-to-guide for ES6 modules syntax. There are similar posts on this blog for all the other syntaxes, classes, generators and so on. So really, I would keep myself up to date about ES6 by following Doctor Axel on Twitter and subscribing to his blog, which is extremely in-depth, well-written, and easy to digest.
I’ve written recently about promises, ES6 classes, ES6 destructuring, modules and dependencies with JSP and on SystemJS, arrow functions and more. It’s kind of a general Javacript blog but most of the content these days tends to be ES6-focused.
Will You Publish a Book on ES6?
Probably not on ES6 particularly. Actually, Doctor Axel behind the 2ality blog is currently writing a book on ES6 which is at exploringjs.com. I believe this will be free online, you can buy PDF and print versions. But this will be the go-to resource. I don’t really see any point in writing one myself because really he’ll cover absolutely everything so I really recommend checking this out as well. I’ll put the link in the chat for that.
About Jack Franklin
Or Become a Codementor!
Codementor is your live 1:1 expert mentor helping you in real time.