

I dont fully understand what you're asking, but I'm going to answer this part: while (curr - start < time) is tricky, but it won't work (just stops my browser and then throw all console logs at once). + fib(n)) and sleep after every "+"? Nah, sleep would be muuuuuch easier.īut still I can't get working example of implementing it. If you know how to get the same result using setTimeout - tell me ) fibanacci is pretty easy task, because there aren't more than 2 recursions, but how about n-recursions (like fib(1) + fib(2) +. wait 1 second before announcing the result wait 1 second before computing for lower n please, don't tell me about setTimeout method because - yes, everything is possible with that but not so easy as using sleep() method.Ĭonsole.log("Computing Fibonacci for " + n + ".") Yes, I know - that question has thousands of answers.
