Jobs
Blogs
Courses
Mentorship
Partners
For Employers
e2e logo

Beginners Guide to ES6 (ECMAScript 6)

mac
  • INTRODUCTION TO ES6.
  • ECMAScript is a JavaScript standard meant to ensure the interoperability of webpages across different web browsers 
  • ES6 stands for ECMAScript 6. 
  • It is the second major revision to JavaScript.
  • ES6 is also called as ECMAScript 2015.


ECMAScript Editions

ECMAScript(ES1) was released in 1997 and it was the first edition.                                                                                                                                 

ES2 was released in 1998 with an  editorial changes. ES3 in 1999 with additional features like regular expression,try-catch,switch etc..,

ES5 in 2009 with addition of array, JSON support, Strict mode, etc.,

ES6 in 2015 and continuously got updated every in 2016,2017 and 2018 with more additional features


ES6  New Features 

  • The let Keyword
  • The const Keyword
  • Arrow Functions


 The let Keyword

  • The let keyword is used to declare a variable.
  • The variables that are defined using let cannot be redeclared.
  • The variables must be declared first before use.
  •   The variables declared with let have Block Scope

Redeclaring Variables

  • The variables declared with let are hoisted to the top of the block but not initialized


The const Keyword

  • The word const doesn't define a constant value , it defines a constant reference to a value.
  • Variables declared with const cannot be redeclared.
  • Variables declared with const cannot be reassigned.
  • Variables defined with const have block Scope
  • Variables  with const keyword must be assigned with values when the are defined.

const Objects and Arrays

  • Elements of const array can be changed, but we cannot reassign the array 
  • Properties of the const objects can be changed, but cannot reassign the object

Arrow Functions

  • Arrow function is a short syntax for writing function Expression.
  • the function keyword , return keyword and curly brackets are not required in arrow function.