It is not possible to do this with the expand prototype template.
You can only do this with the following:
function MyClass() {
var v = 1;
this.getV = function() {
return v;
};
}
And that is why there are some smart enthusiasts for this approach.
Personal setting: Attach the front of it underscore and place it on the object: this._v. Do not fight JavaScript; use it.
source
share