title: Check if function returns true to execute another function
body: <p>I have written a form validation using JS which ends with return(true);</p>
  
  <pre><code>function check() {
    ....validation code
    return(true);
  }
  </code></pre>
  
  <p>All I want is, need to check if check() function returns true, I want to execute another function.</p>
  
  <p>Code I have tried is as follows:</p>
  
  <pre><code>if(check() === true) {
    function() {
      //Another function code
    }
  }
  </code></pre>