[英]Difference between these 2 promises syntax
I am quite confused between these two ways of returning the promises, could someone please explain the difference? 我对这两种回复承诺的方式感到很困惑,有人可以解释一下这种差异吗? I tried to find some whereabouts on google, but couldn't find the exact match.
我试图在谷歌上找到一些行踪,但找不到完全匹配。
var a = Promise.resolve('foo');
return a.then();
vs VS
return Promise.resolve('foo').then();
There's nothing promise specific about this. 对此没有任何具体承诺。
return a.b();
Is the same as: 是相同的:
var c = a;
return c.b();
In this case a
is Promise.resolve('foo')
. 在这种情况下,
a
是Promise.resolve('foo')
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.