title: RxJS: How to wrap and observe string for changes?
body: <p>RxJS: How do you wrap a primitive type such as a <em>string</em> in an <em>Observable</em> and <strong>listen to changes to that primitive</strong>?</p>
  
  <p>Consider the following example. <code>setTimeout</code> simulates some external event that changes the string <code>s</code>. However, the <code>console.log</code> only fires once and not after <code>setTimeout</code> is called. Why is that?</p>
  
  <pre><code>let s = "Hello World";
  Observable.of(s).subscribe(val =&gt; {
      console.log(val);
  });
  // some external event changes variable s
  setTimeout( () =&gt; {
      s = "Wat?";
  }, 1000);
  // Output: prints "Hello World" to console, but not "Wat?"
  </code></pre>
  
  <p>This question might sound a bit dumb, but I searched for 2 hours through all kinds of RxJS docs and examples and most of them play with Arrays or Objects. This is not what I want. I don't want to change attributes, functions, arrays or anything like that. Just a plain string or boolean or number.</p>