title: RxJS, understanding defer
body: <p>I searched for the usage of <code>defer</code> in RxJS but still I don't understand why and when to use it.</p>
  <p>As I understand neither Observable methods is fired before someone subscribes to it.</p>
  <p>If that's the case then why do we need to wrap an Observable method with <code>defer</code>?</p>
  <p><a href="https://doc.ebichu.cc/RxJS/index.html?name=api/core/operators/defer.md" rel="noreferrer">An example</a></p>
  <p>I'm still wondering why it wrapped Observable with <code>defer</code>? Does it make any difference?</p>
  <pre class="lang-js prettyprint-override"><code>var source = Rx.Observable.defer(function () {
    return Rx.Observable.return(42);
  });
  
  var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); } );
  </code></pre>