The function of Message () {
Enclosing _list=[];
This. MSG='hello'
}
Message. The prototype. The attach=function (hero) {
This. _list. Push (hero)
};
Message. The prototype. Notify=function () {
For (var I=0; IEnclosing _list [I] the update ();
}
};
Message. The prototype. SetState=function (MSG) {
This. MSG=MSG;
This. Notify ()
};
Message. The prototype. GetState=function () {
Return this. MSG
};
After the call display this. _list [I]. The update is not a function
CodePudding user response:
Then look at your enclosing _list array what is put inside, put the element on the prototype chain of must have the update method, otherwise will be an error,