ES6 Features

ES6 features in next generation javascript (Variable & Function)

ES6 / ES2015 

June 2015: Perhaps the cause for all of your confusion begins here. You could see, ES6 and ES2015 are the same things.

In this article, I provided a brief introduction into some core next-generation JavaScript features. Here’s a quick summary!

let & const

Read more about let and const

let  and const  basically, replace the var . You use let  instead of var  and const  instead of var  if you never re-assigning this variable then you might use const

ES6 Arrow Functions:

Arrow functions are a different way of creating a function in JavaScript. And a shorter syntax, they offer advantages when it comes to keeping the scope of the this  keyword, for example, see this.

Arrow function syntax may look strange but it’s actually simple

function myName(name) { 

which you could also write as:

const myName = function(name) { 


const myName = (name) => { 

When no any arguments, you should use empty parentheses in the function declaration:

const myName = () => { 
    console.log('John Doe');

when you have exactly one argument, you may omit the parentheses:

const myName = name => { 

When just return a value, then you may use something like that:

const myName = name => name

That’s equivalent to:

const myName = name => { 
    return name;

That is the brief ES6 features based on variables & functions.


Happy Coding.






Leave a Reply

Your email address will not be published. Required fields are marked *