Logo
One missing comma can ruin your whole day.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Promise-chain Memes

Posts tagged with Promise-chain

My Friend Didn't Know How To Use Async Sleep In Javascript, So He Wrote This Massive Chain Of .Then()

Javascript Programming Frontend Webdev
3 months ago 112.5M views 0 shares
My Friend Didn't Know How To Use Async Sleep In Javascript, So He Wrote This Massive Chain Of .Then()
Your friend just reinvented callback hell, but with extra steps. Instead of using a simple await sleep(1000) or even setTimeout , they decided to create the world's longest promise chain that looks like it's trying to reach the bottom of the Mariana Trench. The beautiful irony here is that promises were literally invented to avoid this kind of nesting nightmare. It's like someone handed them a ladder and they chose to stack chairs instead. Each .then() is probably just wrapping another promise that resolves after a delay, creating this magnificent stairway to callback heaven. Fun fact: This code probably has more indentation levels than the JavaScript spec has pages. The real kicker? A simple utility function like const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) would've saved them from this horizontal scroll of shame. But hey, at least they're consistent with their suffering!

Today's picks

TeeUnion Funny DIY Repair Mechanic T-Shirt for Men – I Watched a YouTube Video Shirt Heather Navy

TeeUnion Funny DIY Repair Mechanic T-Shirt for Men – I Watched a YouTube Video Shirt Heather Navy

Affiliate
$17.99
The Only Nvidia Product You Can Actually Afford

The Only Nvidia Product You Can Actually Afford

Hardware
267.0K views 1 year ago
NordVPN

NordVPN

Sponsored
VPN