Skip to content

Instantly share code, notes, and snippets.

View henboffman's full-sized avatar

Ben Hoffman henboffman

View GitHub Profile

Callback Hell

Callbacks are rampant in Javascript, this can cause what's known as "Callback Hell", or as I like to call. Rat nests. In the following example the "rat nest" is not that hard to follow along with, and that will be the case when your program is simple. But imagine when your program grows to have many rat nests, perhaps even the rat nests become intertwined. Messy.

/*
 * Callback hell example
 */

function yell(text, callback) {