Difference between ES5 and ES2015

Hi folks, welcome back. In this module, I will be discussing the difference between ES5 and ES2015. In the previous module, I have discussed inheritance in JavaScript. So, you can read it from our JavaScript tutorial. Now, let’s begin to know about the current topic.

Difference between ES5 and ES2015

Difference between ES5 and ES2015

ES is an abbreviation of ECMAScript. ECMAScript or ES is a trademarked ECMA International scripting language standard. ECMA Script is used primarily for the World Wide Web (WWW) client-side scripting. In 1997, JavaScript became an ECMAScript standard. ES5 and ES2015 or ES6 are the fifth and sixth versions of the ECMA Script respectively. ES5 stands for ECMAScript 5. It is also called ECMAScript 2009 whereas ES6 stands for ECMAScript 6. It is also called ECMAScript 2015.

So, let us have a look at some differences between ES5 and ES6 or ES2015.

ES5

ES2015

It is the fifth version or edition of ECMAScript. It is the sixth version or edition of ECMAScript.
It was released in 2009. It was released in 2015.
It supports primitive data types: string, number, boolean, null & undefined. It has a new primitive data type named Symbol, which supports unique values.
The var keyword in JavaScript is used for defining variables. The var, let & const keywords are used for defining variables in JavaScript.
Due to the absence of some features, the performance of ES5 is lower than ES6. Due to the presence of new features, ES6 or ES2015 has higher performance than ES5.
The Manipulation of objects in ES5 or ECMAScript 2009 is more time-consuming. The Manipulation of objects in ES6 or ECMAScript 2015 is less time-consuming than ES5.
In ES5 or ES 2009, both function & return keywords are used for defining the function. In ES6 or ES 2015, a new feature of the arrow function was introduced, in which the function keyword is not used for defining a function.
It offers a wider range of communities supporting ES5 or ES 2009 compared to ES6. It offers a lower range of communities supporting ES6 or ES 2015 compared to ES5.
A traditional for loop like other programming languages are used for iterating the elements of iterable objects. In ES6, a for…of the loop is introduced for iterating the elements of iterable objects.

Browser Support

Google Chrome 23, IE (Internet Explorer) 10, currently known as Edge & Safari 6 were the first browsers that fully support ES5 or ECMAScript 5. Later, Mozilla Firefox 21 and Opera 15 also started supporting ES5.

Google Chrome 58, Edge 14, Firefox 54, Safari 10, & Opera 55 are the browsers that fully support ECMAScript 2015 or ES6. Among these browsers, Edge 14 & Safari were the first browsers that fully support ES2015. ES2015 is not supported by Internet Explorer (IE).

What are the features of ES5 & ES2015?

Features of ES6 or ES2015

  • Arrow functions
  • Defining variables using let & const keywords along with var keyword.
  • Use of Destructing, Rest & Spread Operators.
  • Objects, Classes & Inheritance.
  • Use of string methods like String.includes(), String.endswith(), String.endswith().
  • New primitive data type, Symbol for defining unique values.
  • Use of JavaScript Modules
  • For/of loop
  • Template Literals
  • Promises

Features of ES5 or ES2009

  • Use of “use strict mode“.
  • Use of array methods like Array.isArray(), Array.forEach(), Array.map(), Array.filter(), Array.reduce(), Array.some(), Array.every() etc.
  • Use of Trailing Commas & Multiline strings.
  • JSON methods like JSON.stringify(), JSON.parse().
  • Object Methods such as Object.defineProperty(), Object.create(), Object.keys() etc.
  • Property names using reserved words.

Many other features are also included in ES5 and ES6.

The ES6 or ES2015 can be converted into ES5 code by using transpilation. For this, we can use two compilers: Babel and Traceur for converting ES6 code to ES5 code.

I hope you have now known some of the differences between ES5 & ES2015. In the next module, I will be discussing the latest version of ECMAScript. If you want to learn JavaScript and other programming languages like Python, C, and Java, you can refer to our website.