
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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) console.log("
The square of the given value is :", result)
Explanation
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)
Explanation
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.
- Related Articles
- ES6 Features and Syntax
- ES2015: Latest version of JavaScript
- New Features of C++17
- ES6 Property Shorthands in JavaScript
- How to compare two string arrays, case insensitive and independent about ordering JavaScript, ES6
- How to convert a plain object into ES6 Map using JavaScript?
- Mega ios updated with new photosync and passcode lock features
- What are the best New features added to iPhone and iPad with iOS12?
- How to new line string - JavaScript?
- ES6 Default Parameters in nested objects – JavaScript
- What are the new features in MySQL 8.0
- What are the new features in Swift 4.0?
- What is the relationship between JavaScript, CoffeeScript, TypeScript, ES5, and ES6?
- How to clone an array in ES6?
- ES6/ECMA6 template literals not working in JavaScript?
