//斐波那契数列
//1, 1, 2, 3, 5, 8, 13, 21, 33
function aa(n){
if(n <= 2){
return 1;
}
return aa(n - 1) + aa(n - 2);
}
alert(aa(3)); // 21
时间: 2024-10-25 19:48:24
//斐波那契数列
//1, 1, 2, 3, 5, 8, 13, 21, 33
function aa(n){
if(n <= 2){
return 1;
}
return aa(n - 1) + aa(n - 2);
}
alert(aa(3)); // 21