title: When to use global variable in jQuery?
body: <p>I need to set the <code>dateFormat</code> for a few datepickers.</p>
  
  <p>What is the best way to define the <code>dateFormat</code>?</p>
  
  <p>Defining a simple method like </p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>function dateFormat() {
      return 'yy-mm-dd';
  } 
  </code></pre>
  
  <p>or Global variable like</p>
  
  <pre class="lang-js prettyprint-override"><code>dateFormat = 'yy-mm-dd'
  </code></pre>
  
  <p>?</p>