Is there a way to use constants in JavaScript?
If not, what\'s the common practice for specifying variables that are used as constants?
ECMAScript 5 does introduce Object.defineProperty:
Object.defineProperty (window,'CONSTANT',{ value : 5, writable: false });
It's supported in every modern browser (as well as IE ≥ 9).
See also: Object.defineProperty in ES5?