In one of Douglas Crockford speeches, He favours the use of tail recursion over loops. this code was presented,
function repeat(myFunc) {
if (myFunc !== undefined) {
retu repeat(myFunc);
}
}
I thought to define a myFunc but don't know if a static counter can retain its state during function calls or use a global counter. but being new to javascript I wanted to ask first. How can this be used in an example, say to count down from 10 to 0? Thanks.
