Goal: write a loop that appends the sum of the last two items in [fib] to the end of [fib] for 20 loops and find the values of the last iteration.
Code Thus Far
let fib = [0,1]
let accumulator = 0
for (t=0;t<20;t++){
endingDigits = fib[-1]+ fib[-2];
accumulator =+ Number(accumulator) + Number(endingDigits);
fib.push(endingDigits);
t++;
}
console.log(fib)
Results I keep getting NaN - Which is why Rap the two negative indices in the number method.
Thanks for the help!