Skip to content

Instantly share code, notes, and snippets.

@Ibro
Created April 28, 2017 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ibro/3120622e7e1a6f1a96407cb9cd669a3d to your computer and use it in GitHub Desktop.
Save Ibro/3120622e7e1a6f1a96407cb9cd669a3d to your computer and use it in GitHub Desktop.
Reduce numbers from 0 to 4 - Coding Blast - www.codingblast.com
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