Skip to Content
Beginning Node.js
book

Beginning Node.js

by Basarat Ali Syed
December 2014
Beginner content levelBeginner
308 pages
7h 10m
English
Apress
Content preview from Beginning Node.js

CHAPTER 10

image

Simplifying Callbacks

The evented/asynchronous nature of Node.js means that it is possible to end up with deeply nested callbacks. There are various strategies in JavaScript that help reduce the callback nesting. In this chapter, we will explore these patterns. These help maintain readability, but more importantly these strategies will help decrease the likelihood of bugs creeping up on you. I promise.

The Callback Hell

Note that as we explore this section, it might seem like the situation is dire. Don’t worry. When we look at promises in the next section, you will find the pot of gold at the end of the rainbow.

An obvious issue with ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Node.js in Action, Second Edition

Node.js in Action, Second Edition

Bradley Meck, Nathan Rajlich, TJ Holowaychuk, Mike Cantelon, Tim Oxley, Alex Young
Node.js for Beginners

Node.js for Beginners

Ulises Gascón
Node.js in Action

Node.js in Action

TJ Holowaychuk, Nathan Rajlich, Mike Cantelon, Marc Harter

Publisher Resources

ISBN: 9781484201879Purchase book