Last active
March 1, 2021 11:51
-
-
Save tudorilisoi/7a17fb454ca3689e68c6336b4c14eafd to your computer and use it in GitHub Desktop.
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
let num = 0 //declare a variable whose initial value is zero | |
//function declaration | |
function increaseNum(){ | |
num++ //increase the value of num by 1 using the increment operator | |
//get the reference to the body element | |
let bodyElement = document.getElementsByTagName('body')[0] | |
//... and set its text value to the value of num | |
bodyElement.innerText = num | |
} | |
//run my increaseNum function at most every 1000 milliseconds (could be later) | |
window.setInterval(increaseNum, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment