title: How to get the length of a key conditionally in an object array using React JS
body: <p>I have an array of objects with size > 0. Now based on the <code>isTraining</code> Key value length from all objects, I have to control the DOM elements.</p>
  
  <pre><code>(7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
      0:
      id: "xxx"
      accreditation: "xxxx xxx xxx"
      institution: "xxxx xxx xxx xxxx xxx xxx"
      location: "xxxx xxx xxx"
      dateStart: "1982-06-01 00:00:00"
      dateEnd: "1984-06-01 00:00:00"
      description: "xxxx xxx xxx"
      award: "xxxx xxx xxx"
      isTraining: "0"
  </code></pre>
  
  <p>For example, If I have 10 objects and among these 6 objects has the <code>isTraining</code> value 0 and remaining 4 objects has the <code>isTraining</code> value 1. Now How can I filter or map through the objects to find out the length of key <code>isTraining</code> with values 0 and 1?</p>
  
  <p>In my case the expected result is something like:</p>
  
  <p>The number of Education is: 6
  The number of Training is: 4</p>
  
  <p>What is the most effective method to iterate and find out the length of a Key based on its value?</p>
  
  <p><a href="https://i.stack.imgur.com/bvPuE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bvPuE.png" alt="enter image description here"></a></p>