title: Efficient way to calculate if the fields are populated using the if condition in javascript when the field list is very large
body: <p>I have a form which has lot of fields consider maybe 100. All of the fields are different such as it could be <code>StartTime DateTime EndTime Value etc.</code>. User can fill whichever the field they want and keep the remaining fields black.</p>
  <p>Now on the <code>Javascript or Node.js</code> side I need to check if the fields are populated for each of them then based on that I need to create an <code>XML</code> file. As of now, I am trying to check if each field is populated using the if the condition. If I proceed in this method then I need to write <code>100 IF</code> condition to manage all 100 fields which are time-consuming and redundant.</p>
  <p>I was just curious if there is any better way of doing it. I tried searching but could not find any relevant post which gives me some sort of idea. If it's duplicate then I am really sorry.</p>
  <p>Does anyone have a better idea?</p>
  <p>As of now, I am checking something like this:</p>
  <pre><code>if(StartTime  != '' &amp;&amp; StartTime  != null &amp;&amp; StartTime  != undefined)
  {
      append(StartTime)
  }
  
  if(DateTime  != '' &amp;&amp; DateTime  != null &amp;&amp; DateTime  != undefine)
  {
      append(DateTime)
  }
      
  if(EndTime  != '' &amp;&amp; EndTime  != null &amp;&amp; EndTime  != undefine)
  {
      append(EndTime)
  }
  
  if(Value  != '' &amp;&amp; Value  != null &amp;&amp; Value  != undefine)
  {
      append(Value)
  }
  
  .
  .
  .
  .
  </code></pre>