JavaScript / October 2, 2010

JS Generator – Fibonacci Example

The function fibonacci contains the keyword “yield” making the function a generator. When the function is called it returns an iterator. The first time the iterator’s next function is called the fibonacci function runs like normal until the yield keyword. Yield works just like return, returning the value specified. The next time “next” is called

Read More