wait 1000 ms js code example
Example 1: wait javascript
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Example 2: js add delay
await new Promise(resolve => setTimeout(resolve, 1000));
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
await new Promise(resolve => setTimeout(resolve, 1000));