Javascript ES6 - My First Impressions

Idowu John Abimbola
4 min readSep 30, 2015

--

If you have been developing for the web for a long time, you must have heard about ES6 or ES2015 by top or addicted JS developers. There has been so much hype about ES6 and how it is going to make javascript a better programming language.

Well, this weekend I wanted to build a simple node module, and I decided to use ES6 so that I can learn the new language. To my utmost surprise, I was able to build the module — slack-history-export — using ES6 and now I have fallen in love with it.

Learning ES6

Learning ES6 was pretty easy for me. I had not worked with ES6 before, but I was able to build and publish a module. One major factor that I presumed made that possible was that I had a deep understanding of ES5 so concepts like classes, spread, promises in ES6 were not hard for me to comprehend. Anytime I got stuck, I would just google what it was I wanted to do or the challenge and amazingly I got answers.

I did not just dive into building the module. I followed a learning process which I would like to share, hopefully, it would help someone planning to learn ES6.

  1. I started by reading this great post on ES6 features by Lukehoban on GitHub. It gave me a big overview of the major features of ES6.
  2. I went to Babel website and played with their online ES6 repl to have hands-on experience about how to write ES6. This really helped in learning the ES6 syntax.
  3. I went to GitHub and check out projects that were built with ES6. I learnt the best practices on structuring a project to use ES6.

In summary, it’s very easy to pick up if you have a deep understanding of ES5 and if you don’t, worry not, Javascript is not hard to learn.

Support

Presently, there is poor ES6 support on browsers (both mobile and desktop) and servers. Statistics about ES6 and its compatibility can be seen on Kangax compatibility table. Though the support is still poor, there are compilers that let you write ES6 and would compile to ES5.

Sometimes you don’t have to wait for the future(ES6), you bring the future to the now.

Major ES6 compilers includes:

According to Kangax compatibility table, Babel has the highest support for ES6, so I would advise you use it just like I did.
You can also try out other compliers.

Community

Support from the community is pretty high and good.

Resources I found helpful include:

  • Mozilla Developer Network(MDN) — it contains almost everything about ES6, so If I need any explanation on a method, I check it out on MDN.
  • Babel Documentation was quite useful. Since I was using their package, I checked it often to see if the method I want to use was supported by them.
  • Stack Overflow was also helpful. I asked a question “whether it was appropriate to use ES6 to build a module” and I got a response promptly with guidance.
  • ES6Katas.org have some great exercises on ES6 that I practiced. I strongly advise you check it out if you are interested in learning ES6.

With ES6, you will never walk alone, the community is robust enough to help you whenever you’re stuck.

Syntax and best practices

It took me a while to adapt to the syntax of ES6. I frequently forgot to use arrow functions, let and const where necessary. I think this is not surprising, happens almost everytime to me especially whenever I am switching between Python and Javascript.

Another thing I had to consciously work on was best practices while writing ES6. I didn’t want to write ES6 just for the fun of it I wanted to write it the good way. So I went through people’s source code on GitHub to have an overview about what writing ES6 looks like. I also found this great article by Elierotenberg on the dos and don’ts of ES6. That really helped me out in writing my module.

Summary

ES6 is the future of Javascript and I feel it’s something that should interest any Javascript developer. It’s way cooler.

Also for people that have been asking for inbuilt methods like those present in Python and Ruby well, ES6 has some in them you will enjoy.

The future by Szafranek

This season for me, it’s a weekend of learning new things. This weekend I would either be hacking on Ruby on Rails or AngularJS2. Follow me to read my next article on that.
I could just start a first impressions series where I learn something new in few days, build something with it and write about it. That would not be a bad idea right? Time will tell.

Do not forget to recommend this articles and comment. You can follow me on twitter @hisabimbola.

--

--

Idowu John Abimbola

An exceptional developer, avid writer. On the path to making the world a better place. you can reach out to me on twitter via @hisabimbola