How ES6 (ES2015) evolved and brought new features to modern day JavaScript?

In this article, you will understand how ES6 (ES2015) evolved and brought new features to modern day JavaScript.

ES6 stands for ECMAScript 6. It is the 6th version of ECMAScript and was created to standardize the JavaScript. The top 10 features of ES6 are: let and const keywords, Arrow Functions, Multi-line Strings, Default Parameters, Template Literals, Destructuring Assignment, Enhanced Object Literals, Promises.

Example 1

In this example, let’s demonstrate the Arrow function(=>) −

console.log("An Arrow function Square has been defined")

square = (x) => { return x * x; }
let inputValue = 6
console.log("The input value is defined as :", inputValue)

let result= square(inputValue)
The square of the given value is :", result)


  • Step 1 − Define an arrow function ‘square’ that takes one number as a parameter and returns the square of that number.

  • Step 2 − Call the function and assign the function call to a value: ‘result’;

  • Step 3 − Display the result.

Example 2

console.log("A class Rectangle is defined that uses constructor ",)
class Rectangle { 
   constructor(x, y) {
      this.x = x;
      this.y = y;
let object = new Rectangle(10, 20);
console.log("A sides of the rectangle are defined as ")
console.log(object.x, " and ",object.y)


  • Step 1 −Define a class ‘Rectangle’ that takes in two numbers as parameters. The Class uses constructors to assign two values.

  • Step 2 −Call the class using an object.

  • Step 3 −Display the values.

Updated on: 16-Feb-2023


Kickstart Your Career

Get certified by completing the course

Get Started