What is JavaScript CALLBACK HELL? 🔥

preview_player
Показать описание
#JavaScript #tutorial #course

// Callback Hell = Situation in JavaScript where callbacks
// are nested within other callbacks to the
// degree where the code is difficult to read.
// Old pattern to handle asynchronous functions.
// Use Promises + async/await to avoid Callback Hell
Рекомендации по теме
Комментарии
Автор

// Callback Hell = Situation in JavaScript where callbacks
// are nested within other callbacks to the
// degree where the code is difficult to read.
// Old pattern to handle asynchronous functions.
// Use Promises + async/await to avoid Callback Hell

function task1(callback){
setTimeout(() => {
console.log("Task 1 complete");
callback();
}, 2000);
}

function task2(callback){
setTimeout(() => {
console.log("Task 2 complete");
callback();
}, 1000);
}

function task3(callback){
setTimeout(() => {
console.log("Task 3 complete");
callback();
}, 3000);
}

function task4(callback){
setTimeout(() => {
console.log("Task 4 complete");
callback();
}, 1500);
}

task1(() => {
task2(() => {
task3(() => {
task4(() => console.log("All tasks completed"));
})
});
})

BroCodez
Автор

Better title would be "What the hell is callback hell?"

legendrags
Автор

daily video from bro, bro is the giga chad of the coding world

OkReXx
Автор

Thanks for the vid bro. It was helpful to actually visualize callback hell. Waiting for async/await video. I have to learn async/await.

jhanaman
Автор

just learned all JavaScript from bro now i understand call backs and asnch js

hwapyongedouard
Автор

If you make DSA in Js that’s the thing that everybody

indian-shorts
Автор

If you want to execute the task one after the other why go for async, you should have used synchronous itself nah?

bhuviramesh
Автор

Why write in JS if you aren't writing a non probable callback hell?

admiralcasperr
Автор

bro i love your content!!. Im a school student and my brother is a advocate, so he wants me to make a website (law firm web page) for himself so that he can receive more clients. Can u make a tutorial on that plz?? Or if u have made one plz share me the link

veerraptor
Автор

2024 - job requirement : know JS callbacks. 😂

kishirisu
Автор

love how you didnt offer any solution or pattern to that problem.

alfonzo