Skip to content

Instantly share code, notes, and snippets.

@janneh
janneh / fibonacci.js
Created November 17, 2015 21:20
Javascript generator function for infinite fibonacci
function* fibonacci() {
let x = 0
let y = 1
yield x
yield y
while (true) yield x < y ? x = x + y : y = x + y
}