Source Code
// fibonacci - loop
// 1 1 2 3 5 8 13 21 34 55 ...
// n(i)=n(i-1)+n(i-2); i<=1, n(i)=1
const fibo = (max)=>{
const ls = []
for(let i=0; i<max; i++){
if(i<=1) ls[i]=1
else ls[i]=ls[i-1]+ls[i-2]
}
return ls
}
const r = fibo(20)
console.log(r) // ok