I'm just wondering if publicly acceptable fields are acceptable in JavaScript (i.e. those that are not covered by constructor closure). While the usual mantra "does not use public fields, uses accessors or properties", I noticed that properties are not yet widely supported in all browsers (IE).
Other languages, like veins in JavaScript "everything is open", for example, Python, do not seem to care too much about hiding information and public fields, even those that are not decorated with properties. So, can this be done in JavaScript?
Example
"Private":
var Class = function()
{
var field = null;
this.getField = function() { return field; };
this.setField = function(value) { field = value; };
};
Public:
var Class = function()
{
this.field = null;
};
source
share