Wondering what the difference between the two code below. In the first case I used this
to refer to the object and in the second case I used the object name. Although both works I was wondering whether there is any real difference between the two.
(function() {
var app = {
init: function () {
app.addLun('Hello');
},
addLun: function(a) {
console.log(a);
}
};
});
})();
and
var app = {
init: function () {
this.addLun('Hello');
},
addLun: function(a) {
console.log(a);
}
};
});
})();