📅  最后修改于: 2022-03-11 14:58:02.297000             🧑  作者: Mango
let fibonacci = function(result, len) {
// result[0, 1]; considering result as an array
if(result.length >= len) {return result;} // exit recursion when limit reached.
result.push(result[result.length-2] + result[result.length-1]);
return fibonacci(result, len); //return function until limit is reach.
}