Professional Documents
Culture Documents
Callback Hell
Callback Hell
function stepOne(callback) {
setTimeout(function () {
console.log("Step One Done");
callback();
}, 1000);
}
function stepTwo(callback) {
setTimeout(function () {
console.log("Step Two Done");
callback();
}, 1000);
}
function stepThree(callback) {
setTimeout(function () {
console.log("Step Three Done");
callback();
}, 1000);
}
function start() {
stepOne(function () {
stepTwo(function () {
stepThree(function () {
console.log("All Steps Done");
});
});
});
}
start();