title: Compare two strings and return values that are not present in both
body: <p>I need (in <code>JavaScript</code>, maybe using <code>RegEx</code>? or some <code>React</code> component) to compare two strings and bold all the words/chars are not present in the "source" string.</p>
  
  <p>For example:</p>
  
  <p>"<em>business plan</em>" compared with "<em>business plafond</em>", should return "<em>business pla<strong>fond</em></strong>"</p>
  
  <p>"<em>business plan</em>" comprared with "<em>plan and monitoring</em>" should return "<em>plan <strong>and monitoring</em></strong>"</p>
  
  <p>Currently I use this method which works but unfortunately not in all cases, I can't find the issue:</p>
  
  <pre><code>compareStrings(a, b) {
  let i = 0;
  let j = 0;
  let result = "";
  
  while (j &lt; b.length)
  {
      if (a[i] === ' ') {
          i++;
      } else {
          if ((a[i] != b[j]) || (b[j] === ' ') || i == a.length)
              result += b[j];
          else i++;
          // }
      }
  
      j++;
  }
          return result;
      }
  </code></pre>
  
  <p>Anyone could help me please?</p>