Javascript - Constant

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > ECMAScript - Grammar Standard

1 - About

constant in Javascript

The const keyword make the variable immutable.

3 - Example

myObject = {
   prop1: 1,
   prop2: 2
};
 
// The const keyword make the variable immutable
const {prop1, var1, prop2} = myObject;
 
console.log("prop1 value is: "+prop1);
console.log("var1 value is: "+var1);
console.log("prop2 value is: "+prop2);

Advertising
web/javascript/es/constant.txt · Last modified: 2019/02/16 17:40 by gerardnico