-
It's an admittedly very weird corner case, but should this work?
js const promiseArray = [Promise.resolve(3), Promise.resolve(1), Promise.resolve(2)]; promiseArray.sort(async (a, b) => await b - await a);Spoiler: it doesn't work, but should it? tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.sort -
Thanks for the replies, I know how to make it work, just wondering if it could/should work as in the tweet above. Someone actually has built an async version of the Array functions: github.com/Bin-Huang/prray#prrayprototypesortasyncfunc.