var chapter = {
num: 7,
title: ‘Creating Functions’,
getNum: function() { return num; }\\without this keyword
};
the output is undefined without the keyword this
var chapter = {
num: 7,
title: ‘Creating Functions’,
getNum: function() { return this.num; }\\with this keyword
};
why does it need this keyword pls explain it in simple way. this is question is repeated i know but i saw them all never satisfied. so pls....
and one thing more what actually this code do.
(function() {
// Function body goes here.
})();
i know a bit that its immediately invoked function but i need some detail explanation . thank u all in advance