Skip to content

Instantly share code, notes, and snippets.

@zemuldo
Created June 22, 2019 21:14
Show Gist options
  • Save zemuldo/ff6efe53454596cad5108517f084c462 to your computer and use it in GitHub Desktop.
Save zemuldo/ff6efe53454596cad5108517f084c462 to your computer and use it in GitHub Desktop.
ugly javascript callback hell
function run (){
i_am_first_but_i_take_10_sec(()=>{
let error_0
if(error_0) throw Error(error_0)
else {
i_am_second_but_i_take_8_sec(()=>{
let error_1
if(error_1) throw Error(error_1)
else{
i_am_second_but_i_take_8_sec(()=>{
let error_2
if(error_2) throw Error(error_2)
else {
i_am_third_but_i_take_6_sec(()=>{
let error_3
if(error_3) throw Error(error_3)
else {
i_am_fourth_but_i_take_4_sec(()=>{
let error_4
if(error_4) throw Error(error_4)
else {
i_am_last_but_i_take_1_sec(()=>{
let error_5
if(error_5) throw Error(error_5)
else {
console.log("Done")
}
})
}
})
}
})
}
})
}
})
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment