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: https://t.co/7VbptW3Riv.
@jaffathecake Yeah, fully agree it could be dangerous. I wonder if asyncSort, asyncMap, asyncFilter,… etc. methods were ever discussed as convenience patterns.
@rauschma It was obviously spec’ed in a synchronous world, but it doesn’t complain either. Engines l@v8jsv8js don’t refuse to run the sort function.
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?
Google announces a 5G smartphone targeting India that shall be affordable for “allâ€. I wonder what this means for the smart feature phone form factor. I can also imagine this will make designing for low-RAM, modest-powered CPU devices even more import
RT @jaffathecake: 🔠In JS functions, which return wins? I’m going to try and convince you it’s the ‘last’ one.
h/t to @littledan for point…