Skip to content

Instantly share code, notes, and snippets.

@WonderDev21
Created January 6, 2018 01:43
Show Gist options
  • Save WonderDev21/5bf8618cb482c4cd1de9786c3ef54a03 to your computer and use it in GitHub Desktop.
Save WonderDev21/5bf8618cb482c4cd1de9786c3ef54a03 to your computer and use it in GitHub Desktop.
Yuki's Answer 3
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