Java Reference
In-Depth Information
repeat = window.setInterval(hello,1000)
<< 6
This should show the message "
Hello
" in the console every second (1,000 milliseconds).
To stop this, we can use the
window.clearInterval()
method and the variable
re-
peat
as an argument (this is because the
window.setInterval()
method returns its
ID, so this will be assigned to the variable
repeat
):
window.clearInterval(repeat);
