title: make variable available in other function
body: <p>I have a function </p>
  
  <pre><code>function formSubmitListener() {
    $(".js-form").submit(event =&gt; {
      event.preventDefault();
  
      let input = fetchInput();
      validateInput(input);
  
      if (isValid) {
        serverCall()
      }
    });
  }
  </code></pre>
  
  <p><code>validateInput</code> returns a <code>isValid</code> boolean of true (if all fields on a form have been filled out) that I need to make available for the if statement. If at all possible I want to prevent the use of a global variable. </p>
  
  <p>How do I make the boolean available ?</p>