1var seconds = 0;
2var el = document.getElementById('seconds-counter');
3
4function incrementSeconds() {
5 seconds += 1;
6 el.innerText = "You have been here for " + seconds + " seconds.";
7}
8
9var cancel = setInterval(incrementSeconds, 1000);