I was looking at w3schools web worker page, and noticed this code:
var i=0;
function timedCount()
{
i=i+1;
postMessage(i);
setTimeout("timedCount()",500);
}
timedCount();
Two questions:
- Is this considered a recursive function?
- If it is, is it resource-intensive?
I'm not fully clear on the nature of recursive functions yet, but I remember hearing that every recursive call gets stored in the memory somewhere. Is this true for all recursive functions? Will that function eventually clog up the memory if it runs for long enough?
Thanks!