title: Checking/ Referencing Empty Array Values (Google App Script)
body: <p>I have a Google Spreadsheet that does some simple cell referencing and math for monthly travel for work. I have a function that reads the values in column A (which are attained by the WEEKDAY() formula on the sheet. It blacks out the whole row if it is a Saturday(value 5) or Sunday(value 6). I need it to format the weekdays a certain way (values 0-4) and, only if the date cell in that row is blank, to reformat that row back to the standard blank. <strong>How do I search through an array (you can see how I created it) and find an empty value in that array</strong>? I will copy-paste an example log of the array values (notice the periodic [])</p>
  
  <pre><code>function weekendClean() {
    var ss = SpreadsheetApp.getActiveSpreadsheet()
    var sheet = ss.getActiveSheet()
    var range = sheet.getRange("A3:A33")
    var value = range.getValues()
    var sheetCheckRange = sheet.getRange(2,2)
    var sheetCheck = sheetCheckRange.getValue()
    if (sheetCheck == "Date") {
      for (i = 0; i &lt; value.length; i++) {
        if (value[i] == 5 || value[i] == 6) {
          var row = sheet.getRange((i + 3), 1, 1, 11)
          var cell = sheet.getRange((i + 3), 3)
          row.setBackground("Black")
          row.setBorder(true, null, true, null, null, null)
          //top, left, bottom, right, vertical, horizontal
          cell.setValue("W")
        } if (value[i] == 0 || value[i] == 1 || value[i] == 2 || value[i] == 3 || value[i] == 4) {
          var section1 = sheet.getRange((i+3), 2, 1, 5)
          var section2 = sheet.getRange((i+3), 8, 1, 3)
          section1.setBackground("white")
          section2.setBackground("white")
          section1.setBorder(false, null, false, null, null, false)
          section2.setBorder(false, null, false, null, null, false)
        } 
      }
    }
  }
  </code></pre>
  
  <p>Also, feel free to clean up that code with explanation (especially for the bit that reads what to do for the weekdays)</p>
  
  <pre><code>[15-09-01 17:54:04:051 PDT] [[1.0], [2.0], [], [4.0], [5.0], [6.0],
  [0.0], [1.0], [], [3.0], [4.0], [5.0], [], [], [1.0], [], [3.0],
  [4.0], [5.0], [6.0], [0.0], [1.0], [2.0], [3.0], [], [5.0], [6.0],
  [0.0], [1.0], [2.0], []]
  </code></pre>