title: implement a simple replace method and still get the capital words
body: <p>I faced a simple but wired issue when I tried to replace a simple string:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const reference = 'then Max have gone with Sara.'; 
  const selector = 'sara'; 
  const phrase = 'Joe';
      
  const result = reference.toLowerCase().replace(selector, phrase);
  console.log(result);</code></pre>
  </div>
  </div>
  </p>
  <p>I have a <code>reference</code> string and I want to replace a <code>selector</code> with a <code>phrase</code>.</p>
  <p>The issue is the selector may be all lowercase so I need to conver reference to all lowercase words to be able to implement the replace method on two all lowercase strings right?</p>
  <p>Now the issue shows up... when I convert the reference to lowercase words then all capital words (like Max as a name!) turn to lower case unexpectedly...</p>
  <p>How can I do the replace method and still get this result:</p>
  <pre><code>then Max have gone with Joe.
  </code></pre>