Get number of occurrences of a character in JavaScript
<p>I have a string that devides some data using <code>','</code>. Now I want to count the occurences of <code>','</code> in that string.  I tried:</p>

<pre><code>var match = string.match('/[,]/i');
</code></pre>

<p>But this gives me null If I try to get the length of the match array. Any ideas?</p>
