essaysLearning in Public 1 min

Train Delays & JavaScript Delays, My Event Loop Epiphany

Carletonville station, not exactly a hub of punctuality, is it? And that’s when it hit me, this whole damn station, this waiting, this uncertainty... it’s the JavaScript event loop, man!

By MoAfrika Skotch Ntilane · 28 May 2025

Learning in Public

Train Delays & JavaScript Delays, My Event Loop Epiphany

By MoAfrika Skotch Ntilane — 28 May 2025

Carletonville station, not exactly a hub of punctuality, is it? More like a place where time goes to take a long, leisurely nap. I was waiting for a train that was probably still deciding whether to grace us with its presence, feeling that familiar simmer of Kasi impatience.

And that’s when it hit me, this whole damn station, this waiting, this uncertainty... it’s the JavaScript event loop, man!

The Main Thread, That One Announcer

Think about it. You've got the main railway line, right? That’s your main thread in JavaScript. It can only handle one train, one task, at a time. When the announcer is squawking about Platform 2, he can’t simultaneously be giving a weather report. If that announcement takes forever, everything else waits. Your code, your website, it just... hangs.

The Callback Queue, All Us Impatient Mzansi Folk

Then there's us. The passengers. We’re the asynchronous operations. We don't just stand on the main line blocking everything. Nah, we get shunted off to the side, onto the platform. That’s the callback queue. We’re all lined up, tickets in hand, waiting for our turn once the main line is clear.

The Revelation by the Rails

Suddenly, all those tutorials, all those abstract diagrams of stacks and queues, they just clicked. Right there, amidst the hopeful sighs and the distant rumble that might or might not be a train. It wasn’t about complex computer science first, it was about managing a flow, handling interruptions, and making sure things happen in a sensible order, even when they’re not happening right *now*.

Leave a reflection

How did this land?

Idea trail

If this resonated, read these next

The Slow Letter

Read at the pace
life actually moves.

One newsletter, sent when there is something worth saying. Pick the rhythms that suit you — nothing more, nothing louder.

No popups. No selling your address. Unsubscribe in one click.