Is there any way to make “private” variables (those defined in the constructor), available to prototype-defined methods?
TestClass = function(){
var priv
Can't you put the variables in a higher scope?
(function () {
var privateVariable = true;
var MyClass = function () {
if (privateVariable) console.log('readable from private scope!');
};
MyClass.prototype.publicMethod = function () {
if (privateVariable) console.log('readable from public scope!');
};
}))();