Error First Callback Patterns in JS

preview_player
Показать описание
There is a common development pattern used in JavaScript, especially in NodeJS, called the Error First Callback Function pattern. This video explains how this pattern works in Node and how we can use it in the browser too.

Рекомендации по теме
Комментарии
Автор

This content is out of this world. Thx a ton professor.

oah
Автор

You are always putting out such good quality content. I'm a fan. Thanks Steve. See you soon!

CodingNuggets
Автор

I think js especially benefits from this pattern, at least in the way I use it, due to the fast and loose way it plays with types. In your browser example, it's seems that there would be no need for checking if value passed is a string if the language had stricter typing (though it still may be necessary to check for null).

At some level, ensuring the integrity of values passed cannot be the responsibility of the language itself, but I can say that after programming in JS for so long the first thing I missed was stricter typing. Though, I wouldn't trade creating objects and adding properties so easily for any other language.

ProfessorSyndicateFranklai
Автор

Something im really confused about is how are err/data passed into the callback function? I mean, they aren't defined/dont exist before it is called, so how can we pass them into the function to use them?

aaronk