Next Generation Javascript Recap
We had our recent CMBJS Meetup where we had some talks about ES6 and some talks which had code of Next-gen JS (Next generation Javascript) and some newbies seems to get confused. We had session some years back when they came to spotlight. But thought of creating a small blog article combining all. Hope you gain something from this short and sweet pointed post.
What is ES5, ES6, ES2015, ES7?
JavaScript standard officialy refered as ECMAScript (ES). ES5 is been standardize in 2009 and took while to get browser support. Then ES6 started to draft and TC39, the team responsible for the drafting the standards decided to move towards yearly model. So ES6 is renamed to ES2015 , ES7 is ES2016, ES8 is ES2017 and all other future proposed changes are refered as ES Next in simple explanation.
let and const
These are two keywords to creating new variables. let is like new and better var removing its functionality made a headaches and const is to define constants.
1 | const name = 'Chathu'; |
Still var is working but better to skip using it.
Arrow functions
No more this keyword issue!
1 | const circumstance = r => 2 * PI * r; |
Modules (Exports and Imports)
book.js
1 | // book.js |
util.js
1 | // util.js |
app.js
1 | // app.js |
Classes
There is two updates in defining class properties. In ES6 you had to use a constructor function to define them. But in ES7 you can define them directly.
** ES6 way **
1 | class Book{ |
** ES7 way **
1 | class Book{ |
Spread and Rest operators
Spread Operator (...) use to spread out Array or Object properties.
1 | const numbers = [2,4,6]; |
Rest operator (...) (Yeah! same operator) used to merge list function arguments to list of array.
1 | const sort = (...args) => { |
Destructuring
This operation help us to easily extract array elements or object properties to store in variables.
1 | // Array destructuring |
1 | // Object destructuring |
For further reading
This was also drafted while ago and I managed to finalize this now. It misses new annoucements but will later add posts about it.





