
Which promise method do you need?
Last week, a flatmate of mine — a seasoned Java/Spring backend developer — knocked on my door with a quick frontend question. He'd been handed a small task on the frontend side of his project, nothing major, and had reached out for a sanity check before pushing his code. He had used Promise.race to implement a fallback — if the primary API failed, he wanted to use the backup. The logic made sense in his head. But the implementation was wrong, and the bug was subtle enough that it had slipped through his initial testing. When I asked him "do you know the difference between race and any ?" , he paused. And honestly? The pause made me think. Because two years ago, I would have paused too. That conversation sent me down a rabbit hole — rebuilding polyfills for all four Promise methods — all , any , race , and allSettled — from scratch, just to make sure I truly understood the internals and not just the surface-level API. Now, there are already separate blog posts floating around on each of
Continue reading on Dev.to Webdev
Opens in a new tab



