Created
April 23, 2020 14:37
-
-
Save NyaGarcia/73d7de00cf78c100de53888ce2e8bb1b to your computer and use it in GitHub Desktop.
Creating an Observable with generate(), passing an object as parameter
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
const evenNumber$ = generate({ | |
initialState: 2, | |
condition: x => x <= 10, | |
iterate: x => x + 2 | |
}); | |
evenNumber$.subscribe(number => console.log(number)); | |
// Output: 2, 4, 6, 8, 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment