Created
June 9, 2024 14:11
-
-
Save ChrisMoney/b60dac0c522b41ef8f99714c8dea4269 to your computer and use it in GitHub Desktop.
Observable - Javascript
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
/* Observables allow you to track changes or data over time, | |
rather than just waiting for a single result like with promises. | |
*/ | |
// Create an Observable that emits a value every second | |
const observable = Rx.Observable.interval(1000); | |
// Subscribe to the Observable and print the emitted values to the console | |
observable.subscribe(value => console.log(value)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment