mirror of
https://github.com/actions/node-versions.git
synced 2025-01-10 18:15:21 +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)); |