title: Declare function inside the body tag leads to "Function not defined"
body: <p>I render a java script function inside the body tag of my html. After the java script there is a button which calls this function which is declared by the <code>onclick</code> attribute.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function f(caller){
          console.log('test');
      }
  &lt;/script&gt;
  &lt;button onclick="f(this)" type="button"&gt;A button&lt;/button&gt;
  </code></pre>
  
  <p>The problem is that it says "ReferenceError: f is not defined". What am I doing wrong?</p>