Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
</body>
</html>
 
const sum = val => val + 1
const fns = [sum, sum, sum]
const original = Rx.Observable.of(0)
const mapped = fns.reduce((acum, fn) =>
    acum.map(res => fn(res)) // Apply and return new observable
, original)
mapped.subscribe(res => console.log("Res: " + res))
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers