Hi all,
Here a snippet of code that I’ve written. When I’m debugging the code and it gets to the setTimeout command, it doesn’t appear to be calling the function again. Instead, it exits the function to the one that called it. Here’s the code:
[CODE]
function factorial(x)
{
factbuff = 1;
factidx = x;
factorialloop();
return factbuff
}
function factorialloop()
{
if (factidx > 0)
{
factbuff = factbuff * factidx;
factidx = factidx-1;
setTimeout(“factorialloop()”, 5);
}
}
Any ideas why setTimeout isn’t working properly? I use setTimeout earlier in the script and it seems to work just fine, so I have no idea why it’s messing up here.
Thanks!