What will the code below output to the console and why?

var myObject = {
foo: “bar”,
func: function() {
var self = this;
console.log("outer func: this.foo = " + this.foo);
console.log("outer func: self.foo = " + self.foo);
(function() {
console.log("inner func: this.foo = " + this.foo);
console.log("inner func: self.foo = " + self.foo);
}());
}
};
myObject.func();

Hi max14 welcome to the forum

Please begin by posting what it output to your console and why you think it output that.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.