let getPromise = ()=>{ return new Promise((resolve, reject)=>{ setTimeout(()=>{ if(Math.random()>0.5) resolve(`success : ${new Date()}`) else reject(`failed : ${new Date()}`) },1000) }) } async function asyncFun() { try { let ret = await getPromise() console.log(ret) } catch(e) { console.log(e) } } asyncFun() // getPromise().then((msg)=>{ // console.log(msg) // }).catch((e)=>{ // console.log(e) // })