Using Javascript setTimeout() in recursive function

function alertNumbers(num)
{ 
if (num > 10)
return
alert(num)
val = ++num
timerID = setTimeout("alertNumbers(val)", 3000)
}
alertNumbers(0)

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.