4 Mins Read  April 11, 2016  Cuelogic Insights

Advantages of JavaScript ES6 over ES5

ES6 is the 6th edition of ECMAScript, standardized in 2015. It brings many engrossing features that were not seen in previous versions like ES5. For instance, let and const, they are blocked scoped declarations and thus not prone to the common errors caused by misunderstanding.

ES5 gives much space for these misunderstandings due to lack of basic language features. That is the reason it drives many developers crazy. As such, several workarounds have emerged. TypeScript is very popular in the .NET world (and here at Wintellect) and CoffeeScript is a kind of a big deal in the Ruby community. Both TypeScript and CoffeeScript provide syntactic sugar on top of ES5 and then are transcompiled into ES5 compliant JavaScript.

Advantages of JavaScript ES6 over ES5

ES6 will tackle many of the core language shortcomings addressed in TypeScript and CoffeeScript. Let us go through the features of ES6 that gives it an edge:

ES6 X-Factor-

ES6 is different because it introduces new syntax, which was a needed transformation/ extension in Javascript. This would definitely help to meet the demands of complex applications written in Javascript. Let us go through the features that has given edge to ES6:


Arrows are a function shorthand using the => syntax. There is a similarity between the syntactical features of C#, Java 8, CoffeeScript and ES6. Both statement block bodies and expression bodies are supported by them, which return the value of expression. Unlike functions, arrows share the same lexical this as their surrounding code.


In ES6, having a single conducive declarative pattern makes class patterns painless thing to use and boosts interoperability. They are a simple sugar over the prototype-based OO pattern. Inheritance, instance and static methods are supported by Classes which makes ES6 more amiable version of Javascript.

Enhanced Object Literals

Purpose of object literals is to support setting the prototype at construction, shorthand for foo: foo assignments, defining methods, making super calls, and computing property names with expressions. When combined they bring object literals and class declarations closer together, and benefits object-based design from some of the same conveniences.


In ES6 modules provide a course to load and manage dependencies through the new import export keywords. Even after having good solutions like 3rd party libraries in ES5, modularity remains an important concept for large applications. The following goals of this version make it an indispensable language feature:

  1. Anticipate and prevent need of globals
  2. Easy reallocation from global code to modular code
  3. Smooth interoperability with existing JS module systems like AMD, CommonJS, and Node.js
  4. Quick collation
  5. Standardized protocol for sharing libraries
  6. Compatibility with browser and non-browser environments
  7. Easy asynchronous external loading

Block Scoping

Scoping becomes an ambiguous affair for developers who has background of C/C#/Java. Hoisting can add to that confusion. ES5 lacked a very essential feature of block scoping, which deranked it in comparison to ES6. Though need became the mother of invention and block scoping came into the scenario. ES6 emerged out with this feature, block scoping can be achieved through using let keyword.


The ES6 is a promising language, where there is an asynchronous operation, there are promises to handle its results and errors. Though callbacks are also designed for the same, but promises provide improved readability via method chaining and succinct error handling. Many JavaScript libraries using Promises, RSVP.js, Q.js, and the$q  in Angularjs service are a few of many examples.

The above features of ES6 are potent enough to make us pursue it.But let us evaluate the real scope of this technology before plunging into it.


The expanse of ES6 right now is limited to the newest browsers, but soon it is going to expand its stretch as it presents a host of elegant solutions and syntax that many developers find appealing and useful. And if developers want to ensure  of ES6 code in older browsers a compiler named Babel can transform ES6 code into ES5 code as part of a build step. Once when all the browsers start implementing the specification, this build step can be removed.

Ember.js 2.0 is going to fully embrace ES6 modules, and Angular 2.0 has literally being written in a superset of ES6 called AtScript. Eventually, plenty of the libraries that have been using older specification of JavaScript to build applications are all going to be written in ES6 in the near future.

And if you are aloof from this incarnation, you would have to pay for the loss as the examples and documentation are going to start to revolve around ES6. This confidence about ES6 is not a fling, but a well thought/ required change that would help to meet the demands of ever larger and more complex applications written in JavaScript.


ECMA Script 6 is an emerging star that is going to encompass all the libraries and frameworks with the help of which we used to create our applications going to be here any day, and more and more of the production libraries and frameworks we use to create our applications are going to be written using this new version of JavaScript. Instead of waiting on the sidelines, we can start using ES6 now with the help of transpilers, and enjoy many of the benefits without worrying about browser compatibility.

Recommended Content

Go Back to Main Page