Función del generador Fibonacci
// Fibonacci generator
function* fibonacci() {
var a = 0;
var b = 1;
while (true) {
yield a;
a = b;
b = a + b;
}
}
// Instantiates the fibonacci generator
fib = fibonacci();
// gets first 10 numbers from the Fibonacci generator starting from 0
for (let i = 0; i < 10; i++) {
console.log(i + ' => ' + fib.next().value);
}
joehannes