Created
October 25, 2019 14:03
-
-
Save traviskaufman/5425b330e4e000f7712309eba477e228 to your computer and use it in GitHub Desktop.
Demystifying RxJS, Part II: Sum of Squares with pipe() / operators
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 oneThroughTen = of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | |
oneThroughTen | |
.pipe( | |
map(n => n * n), | |
reduce((s, n) => s + n, 0) | |
) | |
.subscribe(sqSum => console.log("Squared sum =", sqSum)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment