Member-only story

What is the difference between React ES5 and ES6?

Marika Lam
1 min readJun 21, 2020

--

Definition

  • ES5 stands for ECMA Script 5.
  • ES6 stands for ECMA Script 6.
  • ECMA is a scripting language used to standardize JavaScript and used for client-side scripting for websites.

Data Types

  • ES5: Supports data types, such as string, number, Boolean, null and undefined.
  • ES6: Introduced SYMBOL for unique values.

Arrow Function

  • ES5: Both functions and return keywords are needed to define the function
//ES5
var multiply = function(x,y) {
return x * y;
};
  • ES6: Keywords are not not needed to define the function
//ES6
const multiply = (x,y) => { return x * y };

Object Manipulation

  • ES5: Consumes more time when processing
  • ES6: Can be processed smoothly due to destructing and special operation

Performance

  • ES5: Has a lower performance
  • ES6: Has a higher performance due to the new features and the shorthand storage implementation

Defining Variables

  • ES5: Only use var for defining any variable
  • ES6: Allows also let and const for defining variables

--

--

No responses yet