ECMAScript5 vs ES6
ES5:
- It was introduced in 2009.
- ES5 is the fifth edition of the ECMAScript (a trademarked scripting language specification defined by ECMA International).
- ES5 supports primitive data types (string, number, boolean, null, and undefined).
- Define the variables by using the var keyword.
- Define the variables by using the var keyword.
- A wide range of communities supports it.
- ES5 is time-consuming than ES6.
- Function and return keywords are used to define a function.
- In ES5, there is a use of for loop to iterate over elements.
ES6:
- It was introduced in 2015.
- ES6 is the sixth edition of the ECMAScript (a trademarked scripting language specification defined by ECMA International).
- It introduced a new primitive data type ‘symbol(supporting unique values)’ .supporting unique values.
- 2 new ways to define variables that are let and const.
- New features and the shorthand storage implementation ES6 has a higher performance than ES5.
- It has a lot of community support, but it is lesser than ES5.
- Due to destructuring and speed operators, object manipulation can be processed more smoothly in ES6.
- An arrow function is a new feature in ES6 by which we don’t require the function keyword to define the function.
- ES6 provides the concept of for…of loop to perform an iteration over the values of the iterable objects.