Skip to content

Instantly share code, notes, and snippets.

@yancya
Created June 28, 2017 05:19
Show Gist options
  • Save yancya/32e9b41bf524877d10a42a4b0208caae to your computer and use it in GitHub Desktop.
Save yancya/32e9b41bf524877d10a42a4b0208caae to your computer and use it in GitHub Desktop.
RxJS でフィボナッチ数列
import { Observable, Subject } from 'rxjs';
const subj = new Subject();
subj.take(10).
startWith([1, 1]).
scan(([a, b], _) => [b, a + b]).
do(([a, b]) => console.log(a)).
subscribe();
while (true) { subj.next(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment