title: Override Number.toLocaleString("fa-IR") and change its thousands separator character for Persian numbers
body: <p>I need to reformat numeric values based on the locale format, and to do this I use <code>Number.toLocaleString(&quot;LOCAL&quot;)</code> function. In Iran, the majority of people prefer to use <code>,</code> as a thousands separator character, but <code>Number.toLocaleString(&quot;fa-IR&quot;)</code> uses <code>٬</code> (Technically٬ it is correct).</p>
  <p>Although you can replace the character by using the following code, is there any way to <strong>override</strong> the <code>Number.toLocaleString(&quot;fa-IR&quot;)</code>'s functionality?</p>
  <pre class="lang-js prettyprint-override"><code>function formatNumber(number) {
    let string = number.toLocaleString('fa-IR'); // ۱۲٬۳۴۵٫۶۷۹
    number = number.replace(/\٬/g, &quot;,‬&quot;);
    return string;
  }
      
  formatNumber(12345.6789); // the result: ۱۲,۳۴۵٫۶۷۹
  </code></pre>
  <p>PS: I know there are plenty of similar code-snippets out there, but I would like to override the built-in function (if possible).</p>