Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class fib {
- constructor() {
- this.a = (function*() {
- let a = 0,
- b = 1;
- yield 0;
- while (true) {
- let t = a + b;
- a = b;
- yield b = t
- }
- })()
- }
- get next() {
- return this.a.next().value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement