title: Looping through an object converted to array, and its properties' names. How to do it?
body: <p>I'm trying to loop through an object using Object.keys, and by validating its properties' names.</p>
  <p>EDIT: I've cleaned up a bit of my code, according to some suggestions given in the comment section (thank you so much!):</p>
  <pre><code>const checkForEmptyFields = array =&gt; {
      let emptyField = false;
      const voidArray = array === null || array === undefined;
  
      if (!voidArray) {
          for (let i = 0; i &lt; array.length; i++) {
              const keys = Object.keys(array[i]);
  
              for (let key = 0; key &lt; keys.length; key++) {
                  const irrelevantProperties =
                      keys[key].toLowerCase() === 'observations' ||
                      keys[key].toLowerCase() === 'flag' ||
                      keys[key].toLowerCase() === 'id';
  
                  if (!irrelevantProperties)
                      if (array[i][keys[key]].toString().length === 0) {
                          emptyField = true;
                          break;
                      }
              }
              if (emptyField) break;
          }
      }
      return emptyField;
  };
  </code></pre>
  <p>Somehow the loop catches an undefined value in the array (object converted). What am I missing?</p>
  <p>[Previous shameful mistakey code]</p>
  <pre><code>const checkForEmptyFields = array =&gt; {
      if (array !== null || array !== undefined) {
          for (let i = 0; i &lt; array.length; i++) {
              const keys = Object.keys(array[i]);
  
              keys.forEach((key, index) =&gt; {
                  if (
                      key.toLowerCase() !== 'observations' ||
                      key.toLowerCase() !== 'flag' ||
                      key.toLowerCase() !== 'id'
                  )
                      if (array[i].key.toString().length === 0) {
                          return true;
                      }
              });
          }
      }
      return false;
  };
  </code></pre>