title: Validate Multiple controls at once with most optimized way in javascript
body: <p>I have multiple methods which validates and return Boolean value a control. what can be best way to write the logic so that it validates and highlights all invalid controls, doesn't submit form to server and in future I have to make least code change if new control is added.</p>
  
  <blockquote>
    <p>Aprroach 1.  And ,  OR logic operator will not give correct result</p>
  </blockquote>
  
  <pre><code>if ( (Method1(ctrl1) &amp;&amp; Method2(ctrl2) &amp;&amp; Method3(ctrl3)))
  {  // not   submit to server }
    else    //submit the form
  </code></pre>
  
  <blockquote>
    <p>Approach 2 -  still change in logic will require if new control is
    added for validation</p>
  </blockquote>
  
  <pre><code>var valid1 = Method1(ctrl1);
  var valid2 = Method1(ctrl2);
  var valid3 = Method1(ctrl3);
  if(va1id1 &amp;&amp; va1id2 &amp;&amp; va1id3)
    // not   submit to server 
    else 
      // submit to server 
  </code></pre>