I think I could overdo it, but I can’t let life understand me about it, and I think this is due to ignorance of javascript
var itv=function(){
return setInterval(function(){
sys.puts('interval');
}, 1000);
}
var tout=function(itv){
return setTimeout(function(){
sys.puts('timeout');
clearInterval(itv);
}, 5500);
}
With these two functions I can call
a=tout(itv());
and get a cycle timer to start for 5.5 seconds, and then exit essentially.
By my logic, this should work, but it just doesn't
var dotime=function(){
return setTimeout(function(){
clearInterval(function(){
return setInterval(function(){
sys.puts("interval");
}, 1000);
});
}, 5500);
}
Any understanding of this issue would be appreciated.
source
share