Trying to wait
- This is a bad implementation of a timer
- Code loops until some amount of time has passed
- This will freeze your web page
function wait(milliseconds) {
const end = Date.now() + (milliseconds);
let curr = Date.now();
while(curr < end) {
curr = Date.now()
}
console.log("Done");
}
10 / 27