//callback
function callb(num,callback){
let age = num;
function logAge(){
callback('my age '+age)
}
logAge()
}
callb(24,function(msg){
console.log(msg)
callb(26,function(msg){
console.log(msg)
callb(28,function(msg){
console.log(msg)
})
})
})
//Promise
function Promi(num){
return new Promise((resovle,reject)=>{
let age = num
function logAge(){
resovle('my age '+age)
}
logAge()
reject
})
}
Promi(18).then(msg=>console.log(msg))
Promi(20).then(msg=>console.log(msg))
Promi(22).then(msg=>console.log(msg))
// async await
!(async ()=>{
let getAag1 = await Promi(30)
let getAag2 = await Promi(32)
let getAag3 = await Promi(34)
console.log(getAag1,’\r\n’,getAag2,’\r\n’,getAag3)
})()