Event Loops

As I’m sitting here gearing up to watch Philip Roberts’ video “What the heck is the event loop anyway?” my eight-year old Jack comes over and sits down next to me.

Jack: What’s this about Mom?
Me: Event loops
Jack: What’s an event loop?
Me: Let’s watch and find out.

Twenty six minutes later…

Me: What I gathered from the video was that JavaScript is a single threaded call stack. A call stack records where you are in the stack. The problem you run into with single threaded call stacks is when you have code that is slow. You don’t want slow code because you run code in the browser and nobody wants to wait for that loading circle thing. So the solution they came up with was asynchronous callbacks. This lets you put things in line for later and the stack can keep running. Basically there’s this mythical event loop that is always waiting to push something into the stack from the line it’s been waiting in. What do you think about that?
Jack: *blinks* Mom that is so boring. *gets up and goes to do something else*
Like what you read? Give Amanda Wolgamott a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.