DEV Community

Cover image for What is the difference between ES5 and ES6?
Bilal Niaz
Bilal Niaz

Posted on • Updated on

What is the difference between ES5 and ES6?

*1. ECMAScript 5 (ES5P) : *
The first major modification to JavaScript was ECMAScript 2009, sometimes known as ES5.Contractors who focus on how objects are instantiated are known as function contractors. In ES5, you must use the function keyword and return to define the function, just as you would in any other JavaScript language.
*2. ECMAScript 6 (ES6) : *
The second major change to JavaScript was ECMAScript 2015.Its class allows developers to create an object with the new operator and an arrow function if they don't need to use the function keyword to specify the function, and they can also avoid using the return keyword to get the computer value.
*Difference between ES5 and ES6 : *

  • String, integer, boolean, null, and undefined are all primitive data types supported by ES5.
    But In ES6, there are some additions to JavaScript data types. It introduced a new primitive data type ‘symbol’ for supporting unique values.

  • Only the var keyword can be used to define variables in ES5. In ES5,let and const are two new ways to define variables.

  • When compared to ES6, the performance of ES5 is lesser.

  • In ES 6 Object manipulation is less time-consuming then ES5.

  • To define a function in ES5, both the function and return keywords are used. An arrow function is a new feature introduced in ES6 by which we don’t require the function keyword to define the function.

Discussion (0)