Rx.js 5 : why the scan use the function returned by map
<p><strong>Solved and Closed</strong></p>

<p>The code snippet is from <a href="http://reactivex.io/rxjs/manual/tutorial.html#state-stores" rel="nofollow">rx.js doc</a></p>

<pre><code>var increaseButton = document.querySelector('#increase');
var increase = Rx.Observable.fromEvent(increaseButton, 'click')
  .map(() =&gt; state =&gt; Object.assign({}, state, {count: state.count + 1}));

// We create an object with our initial state. Whenever a new state change function
// is received we call it and pass the state. The new state is returned and
// ready to be changed again on the next click
var state = increase.scan((state, changeFn) =&gt; changeFn(state), {count: 0});
</code></pre>

<p>I get confused here that why <code>changeFn</code> is the right one that returned by <code>map</code> operator?</p>