Created
January 26, 2019 21:55
-
-
Save rasmusvhansen/1d2242fe21bc823e8bf7790a045fa150 to your computer and use it in GitHub Desktop.
RxJS Array Transformation
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
let result; | |
from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).pipe( | |
map(n => n * 2), | |
filter(n => n > 4), | |
map(n => ' Num: ' + n), | |
reduce((acc, str) => acc + str, 'Start:') | |
).subscribe(r => result = r); | |
console.log(result); // Start: Num: 6 Num: 8 Num: 10 Num: 12 Num: 14 Num: 16 Num: 18 Num: 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment