Created
April 28, 2017 03:28
-
-
Save Ibro/3120622e7e1a6f1a96407cb9cd669a3d to your computer and use it in GitHub Desktop.
Reduce numbers from 0 to 4 - Coding Blast - www.codingblast.com
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
import {Observable} from 'rxjs'; | |
console.time('timer'); | |
let source = Observable | |
.interval(100) // interval starts from 0 | |
.take(4) | |
.reduce((acc, val) => acc + val); | |
source.subscribe((value) => { | |
console.timeEnd('timer'); | |
console.log('in next. Value: ', value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment