wait 1s in js code example
Example 1: javascript wait 1 second
setTimeout(() => {console.log('1 second finished!')}, 1000);
Example 2: wait javascript
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
setTimeout(() => {console.log('1 second finished!')}, 1000);
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}