map

RxJS 5 map

by Zach Gover

HTML

<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script>

JavaScript

//emit (1,2,3,4,5)
const source = Rx.Observable.from([1,2,3,4,5]);
//add 10 to each value
const example = source.map(val => val + 10);
console.log('example', example)
//output: 11,12,13,14,15
const subscribe = example.subscribe(val => console.log(val));