title: Getting ReferenceError for own date method in JavaScript
body: <p>I'm using Mozilla Firefox 43.0 on Ubuntu 12.04 LTS. I wrote the following JavaScript method saved in <code>mainScript.js</code>:</p>
  
  <pre><code>function writeDateHu() {
      var days = ["Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat", "Vasárnap"];
      var current = new Date();
      var s = "";
      s.concat("&lt;p&gt;", current.getFullYear(), ". ", (current.getMonth() + 1), ". ", current.getDate(), ".&lt;br /&gt;", days[current.getDay()], "&lt;/p&gt;");
      document.getElementById("datum").innerHTML = s;
  }
  </code></pre>
  
  <p>I've also tried to add them by using + instead of <code>concat</code>.</p>
  
  <p>In the <code>main.html</code> I have the following:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;HomePage&lt;/title&gt;
          &lt;meta charset="UTF-8" /&gt;
          &lt;link rel="stylesheet" type="text/css" href="mainStyle.css" /&gt;
          &lt;script type="text/css" src="mainScript.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body onload="writeDateHu();"&gt;
          &lt;div class="alap"&gt;
              &lt;div class="fejlec"&gt;
              &lt;/div&gt;
              &lt;div class="bal" id="datum"&gt;
              &lt;/div&gt;
              &lt;div class="tartalom"&gt;
              &lt;/div&gt;
              &lt;div class="lablec"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>After loading page, the inspector says me <code>ReferenceError: writeDateHu is not defined</code>. Also, sometimes (e.g. I insert the script in the html) I don't get the error, but nor the date.</p>
  
  <p>Thanks for any advance.</p>