I have a JavaScript function which has a static variable:
function Constants() {
}
Constants.i = '1';
Now according to ECMA 6 we have const keyword. Using this we can make a variable as immutable.
I am not able to find how to use const keyword with function static variable, if I use like below it is not loading the function:
const Constant.i = '1';
It will be very helpful if anyone can suggest the proper way of doing the same.
const.const Constant.i = '1';it will raise an error. Probably it will help you Object.definePropertyconstis not making a variable immutable, it just makes sure the reference to the value won't change.