In this JavaScript lesson we are going to learn about JavaScript Let & Const, as you know JavaScript is a scripting language that was introduced for building web pages alive and interactive with the user. JavaScript is also , often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.
What is ES ?
In the year 1996, a standards organization called ECMA (European Computer Manufacturers Association) International carved out standard specification called ECMAScript (ES) which all browser vendors could implement. And Javascript is the most well-known implementations of ES.
Versions of ES ?
Name | Year | Description |
ES1 | 1997 | It was the first edition of Modern JavaScript |
ES2 | 1998 | Editorial changes only |
ES3 | 1999 | Regular expressions and try/catch added |
ES4 | Null | This version was not released because of some issues. |
ES5 | 2009 | Added some new features like use strict, isArray, foreach, map, filter, reduce and some more. |
ES6 | 2015 | Some new features has been added, that we will talk about this. |
ES7 | 2016 | Some new features has been added, that we will talk about this. |
ES8 | 2017 | Some new features has been added, that we will talk about this. |
ES9 | 2018 | Changes in RegEx and Rest or Spread Properties |
ES10 | 2019 | Some new features has been added |
ES11 | 2020 | Some new features has been added |
JavaScript ES6
ES6 was one of the best progress of JavaScript in recent years. after introducing ES6, the modern programming was introduced in JavaScript.
Let & Const (JavaScript ES6)
Before this in JavaScript we had function and global scope, after introduction of let and const now JS has block scope, and it was a feature in JavaScript ES6.
1 2 3 4 5 6 7 8 9 |
let num = 5; if(num < 6 ) { let greeting = "Hello "; let greeting = "World"; console.log(greeting); } |
1 2 3 4 5 6 7 8 9 |
const num = 5; if(num < 6 ) { const greeting = "Hello "; const greeting = "World"; console.log(greeting); } |