function fb(n) { if (n <= 2) { return 1; } else { return fb(n - 1) + fb(n - 2) } } function fn(n) { var arr = []; for (var i = 1; i <= n; i++) { arr.push(fb(i)) } return arr } console.log(fn(10));