A First Look at ECMAScript 6 using Node.js and Babel

I think of ECMAScript 6 (ES6 or ES2015) as the next version of JavaScript even though that’s not entirely accurate. ES6 has a huge number of changes from the current JavaScript/ES5, which has been around since late 2009.

I wanted to explore the new features in ES6. For me, the only way to really understand any technology is to actually try it out. Unfortunately, ES6 isn’t fully supported yet by browsers like Internet Explorer, Edge, and Chrome, or by engines such as Node.js.

I found that a tool called Babel could help me explore ES6. Babel is a JavaScript “transpiler” meaning it can accept ES6 code as input and translate it to ES5 code which can then be executed through the Node.js engine.

You can use Babel in several ways. You can install Babel onto your machine and then configure it to build a JavaScript file so that the output can be run by the Node.js engine. But I decided to use the simple Babel interactive mode where I pasted some ES6 code into a window on the Babel Web site, and transpiled ES5 code was automatically generated in a second window. Then that output code can be placed in a .js file and executed by the Node.js engine.


From a preliminary look at ES6, it seems that the two most significant new features are the “let” keyword which allows you to have variables with block scope (as opposed to a “var” variable that has global scope), and simplified class definition syntax. I’ll have to look a bit closer at ES6 to see if there are other must-have features.

This entry was posted in Miscellaneous. Bookmark the permalink.