"this" gives myCar object reference inside logColor function but gives window object reference inside the func function why?
var myCar = {
color: "Blue",
logColor: function() {
var self = this;
console.log("In logColor - this.color: " + this.color);
console.log("In logColor - self.color: " + self.color);
var func=function() {
console.log("In IIFE - this.color: " + this.color);
console.log("In IIFE - self.color: " + self.color);
}
func();
}
};
myCar.logColor();
This may not make sense expert javascript developer but my basics are pretty shaken