title: JS Remove Entries from 2D array
body: <p>Totally newbie to JS so apologise for the probably obvious solution to this issue!</p>
  
  <p>I'm trying to write a bit of code for use in google sheets that basically removes elements of a 2D array if the 3rd value in each nested array is empty eg.</p>
  
  <p><code>[[1,2,3],[4,5,,],[7,8,9],[,,,]</code></p>
  
  <p>would become</p>
  
  <p><code>[[1,2,3],[7,8,9]]</code></p>
  
  <p>I've currently got:</p>
  
  <pre><code>if (bkLoc=='HALL'){
        var sumRng = sh.getRange('MIC_SUMM').getValues();
        for (var i =0; i&lt;sumRng.length ; i++){
          if(sumRng[i][2] !== (undefined || '' || null)){
            micSumm.push(sumRng[i]);
          }
        }
      }
  </code></pre>
  
  <p>But the output seems to contains loads of empty arrays almost like its pushing every loop and I'm not sure why. </p>
  
  <p>Any help would be gratefully received!</p>
  
  <p>EDIT1: So with the help of you guys I got it to work. Using Nikhils answer I am now using this for the IF</p>
  
  <pre><code>if (bkLoc=='HALL'){
        var sumRng = sh.getRange('MIC_SUMM').getValues();
        for (j =0; j&lt;sumRng.length ; j++){
          var x = sumRng[j][2];
          if(x != 0 &amp;&amp; x != '??'  &amp;&amp; x != undefined){
            micSumm.push(sumRng[j]);
          }
        }
      }
  </code></pre>
  
  <p>But to be honest I don't really understand it. My understanding was || is OR so in my original code</p>
  
  <p><code>if(sumRng[i][2] !== (undefined || '' || null))</code></p>
  
  <p>If the tested content DOESN'T CONTAIN undefined OR "" OR null , the if statement should be true. I thought &amp;&amp; meant AND so I'm unclear as to why that ever passes</p>
  
  <p>Apologies for being so dumb!</p>
  
  <p>Cheers</p>