fibonacci series using in javascript code example

Example 1: fibonacci javascript

function Fibonacci(valor){
	var anterior = 0;
	var atual = 1;
	var proximo = 1;

	for(let i = 0; i < valor; i++){
		console.log(proximo)
		anterior = atual + proximo;
		atual = proximo
		proximo = anterior
	}
}

Fibonacci(100);

Example 2: fibonacci counter in typescript

'use strict';

let fibonacci: number[] = [0, 1];

function listFibonacci(num: number) {
  for (let i: number = 2; i < num; i++) {
    fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1];
  }
  return fibonacci;
}
console.log(listFibonacci(10));