📜  斐波那契 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:25.729000             🧑  作者: Mango

代码示例6
function fibonacci(num){ 
    var num1=0; 
    var num2=1; 
    var sum; 
    var i=0; 
    for (i = 0; i < num; i++){ 
        sum=num1+num2; 
        num1=num2; 
        num2=sum; 
    } 
    return num2; 
}