var myObject = {
name: function() {
return "Michael";
}(),
age: 28,
sayName: function() {
alert(this.name + ":" + this.age);
}(),
specialFunction: function() {
myObject = this;
if (this == myObject) altert(console.log(this.sayName));
}
}()
};
I am trying to call the methods of an object from other methods in the same object but I'm just getting undefined
.
I thought that inner scope object are allowed to access outer scope objects but this case disregards that rule.