.wait() javascript code example
Example 1: wait javascript
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Example 2: how to wait in javascript
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}