Javascript function arguments has to be a string?
<p>I'm new to javascript so I'm not sure why it's behaving like this.</p>

<p>I have a clock function:</p>

<pre><code>function updateClock()
{
var currentTime = new Date();

var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();
var currentMilliseconds = currentTime.getMilliseconds();

// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes &lt; 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds &lt; 10 ? "0" : "" ) + currentSeconds;

// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours &lt; 12 ) ? "AM" : "PM";

// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours &gt; 12 ) ? currentHours - 12 : currentHours;

// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;

// Update the time display
document.getElementById("clock").innerHTML = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
}
</code></pre>

<p>which is in a separate <code>clock.js</code> file.  I include that file in the head.</p>

<p>I place this under the <code>clock div</code>:</p>

<pre><code>&lt;script type="text/javascript"&gt;
setInterval("updateClock()", 1000);
&lt;/script&gt;
</code></pre>

<p>And it works.  But if I change it to <code>setInterval(updateClock(), 1000);</code>, it won't work.  I spent a while trying to figure out why the function only executed once until I found out I needed to put quotes around the function call.</p>

<p>Coming from different languages background, I don't know why you need to put quotes around it? It looks like I'm passing a string <code>"updateClock()"</code> to the function instead of another function.  I see other people's code where they just define the whole function as a parameter such as <code>setInterval(function(){ ... }, 1000)</code>.</p>
