Forum Moderators: open
ObjectNotation = {
a : 9,
b : 6,
add : function(){
var c = a + b;
alert(c);
}
}
window.addEventListener("load", function(e) {ObjectNotation.add(); }, false);
Changes:
var c = this.a + this.b;
a and b are both properties of the object so are accessed using the this keyword. Read more here,
[developer.mozilla.org...]
Andrew