mirror of
https://github.com/actions/node-versions.git
synced 2025-01-11 18:45:19 +00:00
15 lines
228 B
JavaScript
15 lines
228 B
JavaScript
|
function fibonacci(num){
|
||
|
var a = 1, b = 0, temp;
|
||
|
|
||
|
while (num >= 0){
|
||
|
temp = a;
|
||
|
a = a + b;
|
||
|
b = temp;
|
||
|
num--;
|
||
|
}
|
||
|
|
||
|
return b;
|
||
|
}
|
||
|
|
||
|
console.log(fibonacci(7));
|
||
|
console.log(fibonacci(23));
|