how to pause execution in javascript code example
Example 1: wait javascript
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Example 2: pause javascript
function wait(ms)
{
var d = new Date();
var d2 = null;
do { d2 = new Date(); }
while(d2-d < ms);
}