Calling a javascript function recursively
问题 I can create a recursive function in a variable like so: /* Count down to 0 recursively. */ var functionHolder = function (counter) { output(counter); if (counter > 0) { functionHolder(counter-1); } } With this, functionHolder(3); would output 3 2 1 0 . Let\'s say I did the following: var copyFunction = functionHolder; copyFunction(3); would output 3 2 1 0 as above. If I then changed functionHolder as follows: functionHolder = function(whatever) { output(\"Stop counting!\"); Then