title: Validate if property value is false in all objects of array and pick value of property from first three maximum objects of array
body: <p>I have an array of objects with properties</p>
  <pre><code>let array = [{value: &quot;None&quot;, selected: false, name: &quot;None&quot;},
  {value: &quot;sample utternace&quot;, selected: false, name: &quot;sample utternace&quot;},
  {value: &quot;sample&quot;, selected: false, name: &quot;sample&quot;}]
  </code></pre>
  <ol>
  <li><p>I need to validate from these array of objects if &quot;selected&quot; property of all objects is &quot;false&quot;.</p>
  </li>
  <li><p>if yes then i need to pick value of property &quot;value&quot; for first three at maximum excluding if &quot;None&quot; value.</p>
  </li>
  <li><p>Maximum 3 values of property &quot;value&quot; should be picked if array size is less than minimum 2 values of property &quot;value&quot; should be pushed to array</p>
  </li>
  </ol>
  <p>Tried:</p>
  <pre><code>let newArray = [];
  let sendValues: boolean;
  for (let i = 0; i &lt; array.length; i++) { // validate if all no value selected
      if (array[i].selected === true) {
         sendValues = true;
         break;
         } else {
           break;
         } 
       }                         
        if (sendValues) {                  
                      
              } else {
                  for (let i = 0; i &lt; 4; i++) {
                      if (array[i].value === &quot;None&quot;) {
                          newArray.push();
                      } else {
                          newArray.push(array[i].value);
                      }
                  }           
              }   
          }
  </code></pre>