What is JavaScript CALLBACK HELL? 🔥
ฝัง
- เผยแพร่เมื่อ 18 ธ.ค. 2023
- #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"));
})
});
})
daily video from bro, bro is the giga chad of the coding world
Better title would be "What the hell is callback hell?"
bro, you are a legend.
Awesome explanation
Thank you! Thats helpful!
Thanks for the vid bro. It was helpful to actually visualize callback hell. Waiting for async/await video. I have to learn async/await.
That's coming up after promises
Clean explanation!👏
Nice explanation
simplest and easy style to teach
Very good explanation :D
Thank you so much
Amazing video in 5 mins
just learned all JavaScript from bro now i understand call backs and asnch js
If you want to execute the task one after the other why go for async, you should have used synchronous itself nah?
If you make DSA in Js that’s the thing that everybody
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
I don't have a video where we build a full website together yet. I might do that in the future.
Why write in JS if you aren't writing a non probable callback hell?
2024 - job requirement : know JS callbacks. 😂
love how you didnt offer any solution or pattern to that problem.
That's the next video on promises
@@BroCodez yay!! i can't wait!😁
Nice channel btw, keep up the good work!🔥
0:52 tasks were complete! 💪💋!
1:46
Читать легче. На слух очень плохо воспринимаю.
bro i wanna know who r u
JS is a joke!