Recursive function to find children count in javascript
<p>How can I find out the total children count of each root node P in my JSON object. <em>This is not a DOM structure.</em> Considering P2 's children also children of P1 as P2 is child of P1.</p>

<pre><code>P1-|-C1            (P1 children count 3)
   |-C2
   |-P2-|-C1       (P2 children count 5)
        |-C2
        |-P3-|-C1  (P3 children count 2)
             |-C2
        |-C3
        |-C4
        |-P4-|-C1   (P4 children count 2)
             |-C2
</code></pre>

<p>Thanks in advance. </p>
