title: Can a javascript if statement run without a function?
body: <p>I dont know a whole lot about javascript and i was wondering if this script would run or do i need to put the "if statement" inside some kind of onPageLoad function to run this? Please help.</p>
  
  <pre><code>&lt;script&gt;
  if (time&lt;20)
  {
      alert("Hello World!");
  }
  &lt;/script&gt;
  </code></pre>