Числа фибоначчи для n терминов
const getFibonacciNumbers = (n) => {
let n1 = 0;
let n2 = 1;
let nextNumber;
let fibonacciNumbers = [];
let i = 1;
while (i <= n) {
fibonacciNumbers.push(n1);
nextNumber = n1 + n2;
n1 = n2;
n2 = nextNumber;
}
return fibonacciNumbers;
};
Fierce Ferret