foo:function(){ var self=此; 变量p1=p2=someFunctionThatReturnsAPromise(); 全部承诺([p1,p2]) .then(self.bar); } bar:功能(承诺){ var self=此; console.log(self); }
未定义
foo:function(){ var self=此; 变量p1=p2=someFunctionThatReturnsAPromise(); 全部承诺([p1,p2]) .then(函数(结果){ self.bar(结果); }); } bar:功能(承诺){ var self=此; console.log(self); }
{foo:[函数], bar:[功能]}