fibonacci javascript
function Fibonacci(num){
var before = 0;
var actual = 1;
var next = 1;
for(let i = 0; i < num; i++){
console.log(next)
before = actual + next;
actual = next
next = before
}
}
Fibonacci(100);
fibonacci javascript
function Fibonacci(num){
var before = 0;
var actual = 1;
var next = 1;
for(let i = 0; i < num; i++){
console.log(next)
before = actual + next;
actual = next
next = before
}
}
Fibonacci(100);
javascript fibonacci example
// number fibonnaci to array format
function fibonacci(nums) {
let fib = [0, 1];
let data = [];
for(let i = 2; i <= nums; i++) {
fib[i] = fib[i - 1] + fib[i - 2];
data.push(fib[i]);
}
return data;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us