let

The let variables are mutable i.e. their values can be changed. It works similar to the var keyword with some key differences like scoping which makes it a better option when compared to var.

Example: This example will illustrate how to declare varibale using the let keyword.

javascript




// let
let name = 'Mukul';
console.log(name);
// Prints Mukul
 
name = 'Rahul';
console.log(name);
// Prints Rahul
 
// Trying to declare let variable first and then initialise in another line
let org_name;
org_name = "w3wiki";
console.log(org_name);
// Prints w3wiki


Output

Mukul
Rahul
w3wiki

Introduction to ES6

ES6 or ECMAScript 2015 is the 6th version of the ECMAScript programming language. ECMAScript is the standardization of Javascript which was released in 2015 and subsequently renamed as ECMAScript 2015.
ECMAScript and Javascript are both different.

Similar Reads

ECMAScript vs Javascript

ECMAScript: It is the specification defined in ECMA-262 for creating a general-purpose scripting language. In simple terms, it is a standardization for creating a scripting language. It was introduced by ECMA International and is an implementation with which we learn how to create a scripting language....

ES6

Javascript ES6 has been around for a few years now, and it allows us to write code in a clever way which basically makes the code more modern and more readable. It’s fair to say that with the use of ES6 features we write less and do more, hence the term ‘write less, do more’ definitely suits ES6....

const

The const keyword is used to declare constant variables whose values can’t be changed. It is an immutable variable except when used with objects....

let

...

Arrow functions

The let variables are mutable i.e. their values can be changed. It works similar to the var keyword with some key differences like scoping which makes it a better option when compared to var....

Template literal

...

Object and Array Desctructuring

Arrow functions are a more concise syntax for writing function expressions. These function expressions make your code more readable, and more modern....

Default Parameters

...

Classes

It allows us to use the JavaScript variables with the string without using the ‘+’ operator. Template literal defined using (“) quotes....

Rest parameter and spread operator

...

for/of Loop

Destructing in javascript basically means the breaking down of a complex structure(Objects or arrays) into simpler parts. With the destructing assignment, we can ‘unpack’ array objects into a bunch of variables....

JavaScript Maps and Sets

...

Promises

In ES6, we can declare a function with a default parameter with a default value....

Symbol

...

String Methods

ES6 introduced classes in JavaScript. Classes in javascript can be used to create new Objects with the help of a constructor, each class can only have one constructor inside it....

Array Methods

...

Object Enteries

Rest Parameter: It is used to represent a number of parameter in an array to pass them together to a function....