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.
Example: The below example will explain you the use of const keyword in different situations.
javascript
// Const const name = 'Mukul' ; console.log(name); // Will print 'Mukul' to the console. // Trying to reassign a const variable name = 'Rahul' ; console.log(name); // Will give TypeError. // Trying to declare const variable first // and then initialise in another line const org_name; org_name = "w3wiki" ; console.log(org_name); // Throws an syntax error: missing initializer in const declaration |
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.