Differences between ES5 and ES6

dhanushaperera07

Dhanusha Perera

Posted on March 7, 2021

Differences between ES5 and ES6

Alt Text

Intro

JavaScript remains the most popular programming language in the world due to various reasons, and it is a general-purpose programming language that is standardized by ECMA-262 - ECMA International language specification. ECMAScript is the official name for JavaScript but JavaScript is the most recognized name around the world.

There are multiple editions introduced by ECMA-262 language specification throughout the time but ES5 (ECMAScript 2009) and ES6 (ECMAScript 2015) editions were significant.

Let’s explore ES5, ES6 differences together.

Differences

ES5 ES6
5th edition of the ECMA-262 language specification. 6th edition of the ECMA-262 language specification.
Introduced in the year 2009. Introduced in the year 2015.
There can be seen five primitive data types. string, number, boolean, null, undefined Introduced a new primitive data type along with the data types that were there in ES5. string, number, boolean, null, undefined and symbol (Every symbol value returned from Symbol() is unique.)
‘var’ keyword is the only keyword that was there to define the variables. Introduced let and const keywords other than the ‘var’ keyword to define variables.
When comparing to ES6 performance is slightly low. When comparing to ES5 performance is better.
Since var is used to define variables; there were slight disadvantages, type safety issues. There is a loose nature when comparing to ES6. Variable declared by var, have their scope globally. Variable declared by let, have their scope in the block which they are declared, as well as in any contained sub-blocks.
Developers could not easily declare a constant variable which can not be redeclared when compared to ES6. Constants(const) are block-scoped, much like variables declared using the let keyword. The value of a constant can't be changed through reassignment, and it can't be redeclared. Constants can be declared easily when compared to ES5.
function and return keywords are used to define a function. ES6 introduces us to many great features like arrow functions, template strings, class destruction, Modules
Provide larger range of community support for ES5 when compared with ES6 It provides a less range of community supports than that of ES5.
💖 💪 🙅 🚩
dhanushaperera07
Dhanusha Perera

Posted on March 7, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related