title: short hand array if statement
body: <p>Hello I am pretty new to javascript and I am wondering how I could make my code shorter
  I have an array with multiple items in it and I want to check a few things for each item i can do this with a lot of if statements but i am wondering if there's a &quot;shorthand&quot; way of doing it?</p>
  <p>so is it possible to check all items in my array <code>deaths</code> and see which ones have <code>GetComponent('HealthComponent')._alive == 0 ?</code></p>
  <pre><code>var deaths = [];
  
   if (deaths[0].GetComponent('HealthComponent')._alive == 0) 
       {
  this.GetComponent('HealthComponent')._alive = 1;
   this.GetComponent('HealthComponent')._health = 0;
    this.Broadcast({
          topic: 'health.update',
          health: 0,
          maxHealth: 150,
        }); 
        var selected = this;
    setTimeout(function(){
               
                    
              selected.GetComponent('HealthComponent')._health = 150;
               selected.Broadcast({
          topic: 'health.update',
          health: 150,
          maxHealth: 150,
        }); 
        
           
            },60000);
       
           }
  
   if (deaths[1].GetComponent('HealthComponent')._alive == 0) 
       {
  this.GetComponent('HealthComponent')._alive = 1;
   this.GetComponent('HealthComponent')._health = 0;
    this.Broadcast({
          topic: 'health.update',
          health: 0,
          maxHealth: 150,
        }); 
        var selected = this;
    setTimeout(function(){
               
                    
              selected.GetComponent('HealthComponent')._health = 150;
               selected.Broadcast({
          topic: 'health.update',
          health: 150,
          maxHealth: 150,
        }); 
        
           
            },60000);
       
           }
  </code></pre>
  <p>thanks in advance</p>