async and await
it is nth. but changing final function of promise
function add(a,b){
return new Promise(function(resolve,reject){
setTimeout(()=>{
console.log("hello")
resolve(a+b)
},2000)
})
};
function show(ok){
console.log("sfhljl")
console.log(ok)
}
async function showfinal(){
let var1= await add(10,20);
console.log(var1)
let var2=await multiply(var1);
console.log(var2)
}
showfinal()
console.log("end")
Comments
Post a Comment