title: Google App Script looping through array of values
body: <p>Hello I'm trying to loop through an array of values and If the any of the values is bigger than 0, then the script should send a specific email. I just cant figure it out how to do it. What am I doing wrong? </p>
  
  <pre><code>  var TO = ['email1@gmail.com','email2@gmail.com'];
    var failedOperation = [0, 0, 0, 52, 2, 5,]
    var message1 = 'Check the sheet';
    var message2 = 'Its Ok';
    var subject = 'Your Google Spreadsheet Alert';
  
    for(var i in failedOperation &amp;&amp; var j in TO){
      if(typeof failedOperation[i] &gt; 0){
        MailApp.sendEmail(TO[j], subject, message1);
      }
      else{
        MailApp.sendEmail(TO[j], subject, message2);
      }
    } 
  
  </code></pre>