Loading Now
×

 JavaScript ES6: What’s New?

 JavaScript ES6: What’s New?

We have touched upon ECMAScript in our basic chapters. JavaScript has several versions, and in this chapter, we will discuss ES6 or ECMAScript 6. We’ll explore what’s new in it. But first, let’s look at the current state of JavaScript. There are several versions of JavaScript currently available:

– **ES5 (ECMAScript 5)**: This is the fully supported version of JavaScript in all modern browsers and environments. You can start using ES5 without any hesitation because it’s universally supported, so there’s no need to worry about compatibility.

– **ES6 (ECMAScript 6) or ES2015**: ES6 is currently the most favoured version among JavaScript developers. However, the problem is that it is not yet fully supported everywhere. Though most features are supported now, you still need to be cautious while using it. Sometimes, you might need to use a transpiler to convert ES6 code to ES5.

– **ES2016, ES2017, ES2018, and later**: These are newer versions of JavaScript. You need to be cautious while using these directly as well.

Although ES5 is the safest version among these, you might see many frameworks using ES6. Most frameworks ensure browser compatibility when bundling your code or moving to a production version. In that case, you don’t need to worry about compatibility, and you can confidently use ES6.

### Why ES6? What’s wrong with ES5?

Yes, JavaScript developers are very smart. In ES5, accomplishing a task might require many lines of code, whereas in ES6, you can do it easily with fewer lines and less hassle. Even though JavaScript is an object-oriented language, many aspects of ES5 do not align with object-oriented programming languages. Therefore, some new syntax has been introduced in ES6. Moreover, almost all JavaScript libraries and frameworks use ES6 by default. So, you need to be familiar with ES6.

In this writing on ES6, I will focus on these aspects. I will try to compare each topic with ES5. I hope you have completed the basic and advanced chapters or at least have some knowledge of JavaScript. If not, you need to complete ES5 first. Otherwise, you won’t understand much.

### Hands-on JavaScript

If you want to know which versions are supported by which browsers or environments, you can check the following link. This link gets updated from time to time..\

In this chapter, you need to practise carefully. I suggest practising one topic at a time. This is because ES6 introduces new ways of variable declaration, where you cannot redeclare a variable that has already been declared, nor can you reassign something new to it. If you work with variables of the same name, you might run into issues. So, after completing one topic, you should open a new console or reload it. If the console gets reset in any way, you won’t face these issues.

Post Comment