The method, foo()
is called, sx++ won't change. When I alert(sx)
I get NaN. Should I define the method using prototype?
function fooClass(sx) {
this.sx = sx;
this.foo = function() {
if(booleanIsTrue) this.sx++;
};
}
*Ignore syntax errors, if any. This is not a copy paste. It is correct in my project.
Moving sx++
out side the if statement works.
Any ideas as to why this is happening?