title: Can I convert this into length all at once?
body: <p>This is some part of the JSON. There are other data where the <code>selected</code> genre is book. Hence, I wanted to have an example of how to filter the <code>Movie</code> and count the length of the <code>genre</code> too.</p>
  <pre><code>const data = [{
        &quot;1&quot;: { drama: { Comedy: true, Romance: true } },
        &quot;2&quot;: {
          drama2: { Tragedy: true}
          others: &quot;Dystopian&quot;,
        },
        id: &quot;zaMR9TR7hNV3p3VFNumyNbXMto93&quot;,
        genre: {
          selected: &quot;Movie&quot;,
        },
        displayName: &quot;p1&quot;
      }, 
       {
        &quot;1&quot;: { drama: { Tragedy: true } },
        &quot;2&quot;: {
          drama2: { Romance: true}
        },
        id: &quot;zaMR9TR7hNV3p3VFNumyNbXMto93&quot;, //sample id
        genre: {
          selected: &quot;Movie&quot;,
        },
        displayName: &quot;p2&quot;
      }]
  
   const drama = data.filter(
      (v) =&gt; v.genre?.selected == &quot;Movie&quot;
    )
    
    const comedy = drama.filter(
      (a) =&gt;
      a[&quot;1&quot;]?.drama.Comedy == true
    );
  
    const romance = drama.filter(
      (a) =&gt;
      a[&quot;1&quot;]?.drama.Romance == true
    );
  
     const tragedy = drama.filter(
          (a) =&gt;
          a[&quot;1&quot;]?.drama.Tragedy == true
        );
  </code></pre>
  <p>Is there a way where I could turn the <code>comedy</code>, <code>romance</code>, and <code>tragedy</code> into a length all at once rather than something like this?</p>
  <pre><code>  let n = comedy.length
    console.log(n)
  </code></pre>