Page MenuHomePhorge

fibonacci_tco.js
No OneTemporary

Size
318 B
Referenced Files
None
Subscribers
None

fibonacci_tco.js

function fib(n, a = 0, b = 1) {
if (n === 0) return a;
return fib(n - 1, b, a + b);
}
const start = performance.now();
const result = fib(35);
const end = performance.now();
console.log(`fibonacci(35) = ${result}`);
console.log(`Time: ${(end - start).toFixed(4)} ms (${((end - start) * 1000).toFixed(2)} µs)`);

File Metadata

Mime Type
text/plain
Expires
Wed, Jun 17, 12:56 PM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
555012
Default Alt Text
fibonacci_tco.js (318 B)

Event Timeline