Skip to content

Instantly share code, notes, and snippets.

@gonzaloruizdevilla
Created June 5, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonzaloruizdevilla/8edd7a5c37e74fb1891a8333f92516d4 to your computer and use it in GitHub Desktop.
Save gonzaloruizdevilla/8edd7a5c37e74fb1891a8333f92516d4 to your computer and use it in GitHub Desktop.
Fibonacci secuence as letters
function* fibletter() {
let a = 0;
let b = 1;
while(true) {
yield String.fromCharCode(97 + ((b-1)%26));
[a,b] = [b,b+a]
}
}
gen = fibletter(); for(let a = 1; a < 10; a++) {console.log(Array(6).fill(1).map(v => gen.next().value).join``)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment