The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Understanding Callbacks in Node.js

Understanding Callbacks in Node.js

7:03
In this lesson you will learn what callbacks are, how to use them and why we use them in our Node applications. We start with a simple javascript function and build a second function that uses it as a callback to understand the basic operation of a callback. From there, we create a few more functions that help illustrate how using callbacks can help us keep our code legible and organized as well as allowing us to use generic functions that can bring in extra functionality when needed via the callback.
Watch this lesson now
Avatar
egghead.io

In this lesson you will learn what callbacks are, how to use them and why we use them in our Node applications. We start with a simple javascript function and build a second function that uses it as a callback to understand the basic operation of a callback. From there, we create a few more functions that help illustrate how using callbacks can help us keep our code legible and organized as well as allowing us to use generic functions that can bring in extra functionality when needed via the callback.

Avatar
Tomasz

It is understandable why callbacks are introduced, but with native promise support (from version 4, I believe - we have version 7 now) callback's approach should be marginalized.

Avatar
Will

Yup, agreed.
This lesson was recorded when 0.12 was the latest and greatest. Callbacks are still a large part of the existing ecosystem, so it's good knowledge for those new to node.js. Stay tuned for some new lessons on Promises in node.js in the next couple of weeks!
Thanks for your feedback!

In reply to Tomasz
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?