title: Jade: load external javascript and call function
body: <p>I was learning Express/Node/Jade and now in the Jade file I want to include a javascript file from the public folder just for the page.
  For example, in jade file I type this:</p>
  <pre><code>script(src='/javascripts/test.js')
  </code></pre>
  <p>and inside test.js I have a function</p>
  <pre><code>function check_test(){
      return &quot;It's working!&quot;
  }
  </code></pre>
  <p>then I try to call the function in Jade by</p>
  <pre><code>- var test_response = check_test()
  </code></pre>
  <p>than I got the error saying that &quot;undefined is not a function&quot; and test.js isn't load at all.
  Apparently Jade doesn't load the file, they only transform into HTML code.</p>
  <p>I look someone else's question and this is the closest one I can found but it doesn't provide a clear answer of what to do.
  <a href="https://stackoverflow.com/questions/21868080/in-jade-how-can-you-call-a-function-in-an-external-javascript">In Jade, how can you call a function in an external Javascript</a></p>
  <p>So my question is: In this case what should I do to make it work?</p>
  <p>I don't want to load the file in layout.js since I only want test.js only be use by this page.</p>