EcmaScript 5 versus ES6

We create open-source because we love it, and we share our finding so everyone else can benefit as well.

js

EcmaScript 5 versus ES6

I continue to hear professionals complain about ES6, and watch followers hold the same opinion due to a fear of change. Even being fairly new to JS, this is the first time I’ve seen people completely retaliate against their own language. I plan to cover what I’ve experienced, and why I think this is a mindset to try to avoid.

ES6 Releases

When I first started learning JavaScript in 2015, I was first introduced to ES6. For months I avoided ES5, but when I went back to focus on the basics I was forced to use it. Even though I found ES6 to be much cleaner, I still found myself enjoying ES5 once I really started understanding it. This was the same thing I heard from people trying ES6 for the first time. While it looks “alien”, everyone loves the syntactic sugar, as well as the classes. I remember writing my first prototype constructor in ES5, and thinking, “Wow, this is drastically different compared to ES6”.  Still, I wanted to take the time to learn both sides.

The Big Change

I remember being resistant myself with other languages, but I quickly found that it only hindered my own growth. I thought, “if you really want to be or continue to be a programmer, objecting to change is not the way to continue your career”. From C# (Then C++.NET) to Python, each language went through changes to appeal to the evolving patterns, paradigms and best practices. JavaScript was hit with a wave of innovation that made the demand for the impossible, possible. Instead of being a browser-only language, NodeJS has become a major back-end, and declarative structures are on the rise.  Sure, you may want to stay as a front-end developer, but even browsers are mostly ES6 (es2015) ready. While most code is currently transpiled to ES5, it’s surely not going to stay that way for long.

ES5 Retention

On a good note with ES6, ES5 syntax has not been phased out. Meaning you can continue how you would normally, and gradually use ES6 for the sweet sugar. Like the founders of Elm always say, “Write just a little bit of your project with it, and then a little more. You do not need to refactor the entire project, just add a little bit at a time”. This can be said for ES6 just as well, except with ES6, you can mix it with ES5. If the sight of task-runners, and bundlers is what is turning you away, simply look around GitHub for boilerplates. You can clone, run, and done.

Summary

I highly recommend learning ES6. With ES 2015, the syntax is amazing, it allows for easily written declarative structures, as well as easily readable code. The class ability allowing for the easily written ability to create entire closures, with the ability to easily expose any method to the public with a single keyword. There are many other patterns, like ‘let’ singletons, and hoisting temporal dead zones. You also have the built-in Promises and Generators that help create amazing asynchronous control flows when working asynchronously. There’s just so much possibility, and I’ve only skimmed the surface.

To learn more about ES6, I highly suggest checking out this great Article over at Medium.

 

No Comments

Add your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.