ECMAScript (ES) is a standard for scripting languages, including JavaScript. It specifies the core features that a scripting language should provide and how those features should be implemented.
ES6, also known as ECMAScript 2015, has several major new features and improvements:
1. Arrow functions: These provide a new syntax for defining functions. Arrow functions not only make the code shorter, they also have lexical ‘this’ value.
1. Classes: ES6 now supports object-oriented programming with class-based inheritance.
1. Promises: Promises are used to handle asynchronous operations, they give a simpler alternative to the traditional callback syntax.
1. Modules: ES6 allows developers to separate their code into multiple files called ‘modules’.
1. Let and Const: These two new types of variable declarations ‘let’ and ‘const’ are block scoped, it means they only exist within the block they were declared in.
1. Template literals: These are a new type of string literal using back-ticks instead of quotation marks. They provide a concise and convenient syntax to create strings and to include variables and expressions in a string.
1. Default parameters: These allow developers to initialize functions with default values.
1. Destructuring assignment: This feature allows developers to unpack values from arrays or properties from objects into distinct variables.
1. Rest Parameters and Spread operator: The rest parameter syntax allows representing an indefinite number of arguments as an array. The spread operator allows an iterable to expand in places where zero or more arguments for function calls or elements for array literals are expected.
1. Generators: They are special functions which can be paused and resumed, which makes them very powerful for implementing iterator behavior.
These are some of the major updates in ES6, it also includes many other smaller improvements over ES5.