title: Calling a javascript function from other file
body: <p>I have a javascript file that I'm am calling in the <code>head</code> of an HTML file, it's called <code>custom.js</code>, it defines this function:</p>
  
  <pre><code>var example = function(element){
    console.log(element);
  };
  </code></pre>
  
  <p>Then in the actual HTML document, just before the body tag closes, I try to initialize it by calling the same function like this</p>
  
  <pre><code>example('.header-background');
  </code></pre>
  
  <p>I get the error example is not a function, what exactly am I doing wrong? Thank you so much for your help.</p>
  
  <p>here is a bit more context </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  
   // the main body of html
  
  &lt;script src="custom/custom.js"&gt;&lt;/script&gt; // here is the file with the example function
  
  example ('.header-background'); // here im calling the function
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>