calback hell

if there is callback inside callback than the execution of all program takes much time and is irrelevant this case is called callback hell


first addition 

\second multiplication

callback hell is solved by promises

function callback(a,b){
    console.log("multiplication is"+a*b)
}

function wow(a,b,callback){
    let c=a+b
    console.log("addition of "+a+","+b+"is"+c)
    callback(a,b)
}
function add(a,b,wow){
    setTimeout(()=>{
        wow(a,b,callback)
        
    },2000)
}
add(2,3,wow)
console.log("done")

Comments