title: Javascript loaded check through jquery getscript
body: <p>I want to load a Javascript file on the click event instead of loading at the page load event, for performance reasons.
  Is there anyway to know that particular if javascript is already loaded?</p>
  
  <p>Right now I am maintaining a global variable to check the 'loaded' event</p>
  
  <pre><code>var javascriptLoaded=false
  
  if (!javascriptLoaded)
          $.getScript('/scripts/test.js', function() {
              javascriptLoaded = true;
              setTimeout(function() {
              callSomeFunctionhere(); 
              }, 1000);                     
          });
  </code></pre>
  
  <p>Is there any better way of doing this?</p>