title: String Cannot read property 'replace' of undefined
body: <p>I can't figure out what im missing here. </p>
  
  <p>I set a prototype to String in my utils.js</p>
  
  <pre><code>String.prototype.toTitleCase = () =&gt; {
      return this.replace(/\w\S*/g, (txt) =&gt; {
          return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
  };
  </code></pre>
  
  <p>And when I test it from app.js</p>
  
  <pre><code>import * as utils from 'utils'
  
  "This is a test".toTitleCase();
  </code></pre>
  
  <p>I get an error : <code>TypeError: Cannot read property 'replace' of undefined</code></p>
  
  <p>I think prototyping is more clean than creating a function to do this. That's why I want to understand. Thank you!</p>