Last active
February 4, 2018 12:52
-
-
Save RodolfoSilva/9049257 to your computer and use it in GitHub Desktop.
diferenca-entre-settimeout-e-setinterval-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $watch = document.querySelector("#relogio") | |
const $timeout = document.querySelector("#delay") | |
const showCurrentTime = () => { | |
const date = new Date() | |
$watch.innerHTML = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}` | |
} | |
setTimeout(() => { | |
$timeout.innerHTML = `setTimeout foi executado com sucesso.`; | |
}, 5000); | |
setInterval(showCurrentTime, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment