Is there someone who can provide an answer?
What will be the output of the code snippet below when logged to the console and why?
(function(){
var a = b = 3;
})();
console.log("Is 'a' defined? " + (typeof a !== 'undefined'));
console.log("Is 'b' defined? " + (typeof b !== 'undefined'));
What do you expect the following code block to print to the console, and what is the reason behind it?
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();