Calculator with Async/Await
let o=5;const e=(o=1e3)=>new Promise((e,l)=>{isNaN(o)?l(new Error("Delay only except milliseconds")):setTimeout(()=>e(`waited for ${o} ms`),o)});console.log("x = "+o),async function(){try{console.warn("Give me two seconds, first empty my coffee and then I will multiply x by 2");let l=await e(2e3);console.log("%c "+l,"color: blue"),o*=2,console.log("x * 2 = "+o),console.warn("Give me a sec, I'm coming down and add 6 to x"),l=await e(),console.log("%c "+l,"color: blue"),o+=6,console.log("x + 6 = "+o),o-=1,console.log("x - 1 = "+o),document.querySelector("pre").innerText="x = "+o}catch(o){console.error(o)}}();