Tell us what’s happening:
I don’t know what is wrong in this code of mine. I think it is perfect and should work well.
Your code so far
function fibonacci(n) {
let fn0 = 0;
let fn1 = 1;
let temp = 0;
for(i=0; i<n; i++){
temp = fn1;
fn1 = fn1 + fn0;
fn0 = temp;
}
return fn0
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Challenge Information:
Rosetta Code Challenges - Fibonacci sequence