Created
January 29, 2018 11:50
-
-
Save malikkurosaki/289072ca7b95e35680907180fed5406b to your computer and use it in GitHub Desktop.
super simple javascript timer or increment value with timer
This file contains 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
<div id="show"></div> | |
<script> | |
function timer(){ | |
var i = 0; | |
setInterval(function(){ | |
i++; | |
document.getElementById("show").innerHTML = i; | |
if(i > 5){ | |
i = 0; | |
} | |
},1000); | |
} | |
timer(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment