Рет қаралды 26
The key to getting this question right is that async functions return a new promise.
console.log(a() === b()): false. async functions always return a new promise, so even if a() had the exact same implementation as b() (or vice-versa), it would still return false. However, do note that a() returns the promise returned by f() wrapped in another promise, while b() returns the result of the promise returned by f() wrapped in a promise.
console.log(b() === c()): false. b() returns a new Promise object wrapping the result of the promise returned by f(), while c() returns the original Promise from f().
console.log(a() === c()): false. a() returns the promise returned by f() in another new promise, while c() just returns the promise returned by f().