Last active
April 13, 2020 10:25
-
-
Save hw0k/a70c7c532a0b86c8ba517443e0a53e43 to your computer and use it in GitHub Desktop.
FP Intro 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* infiniteValue(acc = 0) { | |
yield acc; | |
yield* infiniteValue(acc + 1); | |
} | |
const iter = infiniteValue(); | |
console.log(iter.next().value); // 0 | |
console.log(iter.next().value); // 1 | |
console.log(iter.next().value); // 2 | |
console.log(iter.next().value); // 3 | |
console.log(iter.next().value); // 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment