I am using a setter to give a variable in my class a new value. However, after the value is set and is used in another method the variable defaults back to its original value.
The following code is not the actual code in my project....
var canContinue = false;
classXX.prototype.check = function() {
if(canContinue){
//do something
}
}
classXX.prototype.init = function() {
canContinue = false;
}
classXX.prototype.setCanContinue(val) {
canContinue = val;
}
return {
getInstance: function() {
_instance = new classXX();
return _instance;
}
};
After the class has been instantiated canContinue = true; If i make the call classXX.setCanContinue(false) then the check function still sees canContinue as true.
Am I missing something?