In javascript, why does this code work?
var myVar=setInterval(
function(){
myTimer()
},1000
);
function myTimer()
{
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t; //displays time
dpcument.getElementById("demo2").innerHTML = myVar; //displays 1
}
Why does myVar hold the value 1 even if I am not returning anything from the function?