//setinterval on and off
h1 = document.querySelector("h1")
h2 = 0
document.querySelector("#onoff").value = "On"
function funi(){
tr = setInterval(() =>h1.innerHTML = h2 ++, 1000)
}
function onoff(){
currentvalue = document.getElementById('onoff').value;
if(currentvalue == "Off"){
clearInterval(tr)
document.getElementById("onoff").value="On";
}else{
funi()
document.getElementById("onoff").value="Off";
}
}