title: What does the switch statement in this RxJS example do?
body: <p>I don't understand what the following documentation means in this <a href="http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-switch" rel="nofollow noreferrer">RxJS example</a>. Can someone answer?</p>
  
  <blockquote>
    <p>The outcome is that <code>switched</code> is essentially a timer that restarts
    on every click. The interval Observables from older clicks do not
    merge with the current interval Observable.</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>var clicks = Rx.Observable.fromEvent(document, 'click');
  // Each click event is mapped to an Observable that ticks every second
  var higherOrder = clicks.map((ev) =&gt; Rx.Observable.interval(1000));
  var switched = higherOrder.switch();
  // The outcome is that `switched` is essentially a timer that restarts
  // on every click. The interval Observables from older clicks do not merge
  // with the current interval Observable.
  switched.subscribe(x =&gt; console.log(x));
  </code></pre>