15 02 2010
“Everything old is new again”
Further thinking gave me the idea that it would be nice to have this function do something more weird and confusing. This useless function should give as the output the number of times it has been called (for example in alert box). The challenge of this puzzle is that it must give output only at the end of the execution, with the last call.
That means that code like that
fnc()()()()()()() MUST show one alert box with text “Fnc called 7 times”.
After some experiments I found a solution for this puzzle and I figured that you might also want to challenge yourself by finding out the way it can be done. So, I propose everyone to post their solutions in the comments.
Try it live :
If you decided that it’s enough for you to break your head with this puzzle, you can always check my solution (in html code ).
I hope you liked my idea, and also get enthusiastic, like I did, when I was searching for the answer.
The original entry was posted on Saturday, July 12th, 2008 at 4:12 pm