js wait for seconds
//A
setTimeout( () =>{
//C - 1 second later
}, 1000);
//B
js wait for seconds
//A
setTimeout( () =>{
//C - 1 second later
}, 1000);
//B
javascript wait 10 seconds
setTimeout(function () {
// ...
}, 10000);
// or
.then(() => {
// ...
({ timeout: 10000 });
});
wait n seconds in js
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function demo() {
console.log('Taking a break for 2 seconds...');
await sleep(2000);
console.log('2 seconds later');
}
demo();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us