Atraso no JavaScript
setTimeout(function() {
//your code here
}, 1000);
Tender Toad
setTimeout(function() {
//your code here
}, 1000);
var delayInMilliseconds = 1000; //1 second
setTimeout(function() {
//your code to be executed after 1 second
}, delayInMilliseconds);
$(this).delay(1000).queue(function() {
// your Code | Function here
$(this).dequeue();
});
console.log("Hello");
setTimeout(() => { console.log("World!"); }, 2000);
console.log("Goodbye!");
console.log("Hello");
setTimeout(() => { console.log("World!"); }, 2000);
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
console.log("Hello");
sleep(2000).then(() => { console.log("World!"); });