How can you make a variable/Object read only in Javascript? [duplicate]
In the current widely available implementation, ECMAScript 3 there is no support for real immutability. UPDATE: Nowadays, the ECMAScript 5 standard is widely supported. It adds the Object.seal and Object.freeze methods. The Object.seal method will prevent property additions, still allowing the user to write to or edit the existing properties. The Object.freeze method will completely … Read more