title: Is it possible to replace only one character in a string if that character appears twice consecutively?
body: <p>So I made a method to make the first letter of all the words in any string Uppercase.<br></p>
  
  <pre><code>String.prototype.toMyCase = function () {
      let strArray = Array.from(this.split(" "));
      for(let i=0; i&lt;strArray.length; i++){
          strArray[i] = strArray[i][0].toUpperCase() + strArray[i].substr(1);
      }
      let newStr = strArray.toString();
      let finalStr = newStr.replace(/,/g, " ");
      return finalStr;
  };
  </code></pre>
  
  <p>The problem with this is when I pass a string that has real commas(,) it replace that comma(,) too in the finalStr step. For e.g <br>
  <code>console.log("How can mirrors be real, if our eyes aren't real".toMyCase();</code> gives me<br></p>
  
  <p><em>How Can Mirrors Be Real &nbsp;If Our Eyes Aren't Real</em> (there are two spaces after Real).</p>