shouldn't i be able to assign object values to 'this' in a prototype of a js object? i think the answer is no since i'm asking this, but i need ideas on a different way to do this.
PHP Code:
function myclass(foo, bar) {
this.foo = foo;
this.bar = bar;
}
myclass.prototype.update(newfoo, newbar) {
this.foo = newfoo;
this.bar = newbar;
}
// now i'll try it
var myobj = new myclass(0, 0);
myobj.update(1, 1);
// myobj.foo and myobj.bar still equal 0 here
so, from a prototype, or any member function of a javascript class, how do i change a member property? this seems so basic.