So I have a psudo "Class" with functions and vars inside of it
for this question I'll just use an example:
function MyClass()
{
this.a = 0;
this.b = function(c)
{
this.a += c;
}
}
then when I go to use it later i'll do this:
var myObject = new MyClass();
myObject.b(3);
myObject.b(5);
but when I do this:
console.log("A: " + myObject.a);
I get:
A: 0
What am I doing wrong?
No comments:
Post a Comment