ES6 was the second major revision to javascript which is also known as ECMAScript 2015. There are some drastic changes that are introduced in ES6. In this article, we are going to discuss the top 5 of those.

Block Bindings:

First, let’s look at this block of code:

Here, we may think that variable value exists inside the if loop. Wrong! After running this code this code looks like this:

The declaration of value has been hoisted in the top. Which means the variable value is still accessible within else loop. But this is not what we wanted. to solve this problem ES6 has came up with ‘let’ and ‘const’.