Created
January 6, 2018 01:43
-
-
Save WonderDev21/5bf8618cb482c4cd1de9786c3ef54a03 to your computer and use it in GitHub Desktop.
Yuki's Answer 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i; | |
var fib = []; | |
var fibNumbers=[]; | |
fib[0] = 0; | |
fib[1] = 1; | |
for(i=2; i<=60; i++) | |
{ | |
fib[i] = fib[i-2] + fib[i-1]; | |
fibNumbers.push(fib[i]) | |
} | |
var arr = [1,9,60]; | |
function nextFibonacci(arr) { | |
for(n of arr){ | |
for(fibNumber of fibNumbers){ | |
if(n<fibNumber){ | |
console.log(fibNumber); | |
break; | |
} | |
} | |
} | |
} | |
nextFibonacci(arr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment