title: Javascript Regex: replacing the last dot for a comma
body: <p>I have the following code:</p>
  
  <pre><code>var x = "100.007"
  x = String(parseFloat(x).toFixed(2));
  return x
  =&gt; 100.01
  </code></pre>
  
  <p>This works awesomely just how I want it to work. I just want a tiny addition, which is something like:</p>
  
  <pre><code>var x = "100,007"
  x.replace(",", ".")
  x.replace
  x = String(parseFloat(x).toFixed(2));
  x.replace(".", ",")
  return x
  =&gt; 100,01
  </code></pre>
  
  <p>However, this code will replace the first occurrence of the ",", where I want to catch the last one. Any help would be appreciated.</p>