title: Adding commas to Django for loop values
body: <p>I am trying to write a javascript to 3 digit comma separate number values that are passed in through my django database and can't figure it out. Exp: (1000 -&gt; 1,000). Before writing the JS, I am also trying to figure out if I comma separate these values, will they mess up potential usage in other JS code that utilize these numbers to do math? Thanks.</p>
  <pre><code>    &lt;table class=&quot;database-table&quot;&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Market Value&lt;/th&gt;
              &lt;/tr&gt;
  
          &lt;/thead&gt;
          &lt;tbody&gt;
              &lt;tr&gt;
                  {% for s in securities %}
                          &lt;tr&gt;
                              &lt;td id=&quot;security-value&quot;&gt;${{s.market_value_of_security}}&lt;/td&gt;
                          &lt;/tr&gt;
                  {% endfor %}
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  
      &lt;script&gt;
        const security_value = document.getElementById(&quot;security-value&quot;);
  
  
        function numberWithCommas(x) {
           return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
          }
  </code></pre>