functionsleep(ms=0){returnnewPromise((resolve)=>setTimeout(resolve,ms));}//get the result after a secondsleep(1000).then((data)=>console.log("data",data));
this and that in js, that refering to the main this in a scope, while you are going deeper into a scope this will refer to the deeper element, while that will refer to the parent: