[CODE]
var Nargle = function() {
var zadlezo = 6;
this.editZadlezo = function() {
zadlezo = 9;
}
this.alertZadlezo = function() {
alert(zadlezo);
}
}
I don’t understand. Calling editZadlezo and then alertZadlezo results in an alert of 6, not 9. The zadlezo inside editZadlezo seems to be only local and hides the zadlezo I want to edit. I have also tried using this, as below, with the result being the same.
[CODE]
var Nargle = function() {
this.zadlezo = 6;
this.editZadlezo = function() {
this.zadlezo = 9;
}
this.alertZadlezo = function() {
alert(this.zadlezo);
}
}
Please tell me how to access/change an object’s variable from within one of its methods.
Thanks!
Grape