Jumlah bilangan fibonacci ganjil js
//sum-all-odd-fibonacci-numbers-in-js
function (num) {
let a = 1;
let b = 1;
let sum = 1;
while(b <= num){
if(b % 2 == 1){
sum += b;
}
let temp = b;
b = a + b;
a = temp;
}
if(sum ==2){
return "Number";
}
return sum;
}
Hatim Eddinani