What is the scope of a 'var' declared inside a function?
<p>Could someone clarify for me please... I've read that creating a variable using reserved word 'var' makes that variable public but how can that be if the variable was created inside a function: </p>

<pre><code>$('#timeIn').timepicker({ 'scrollDefaultNow': true });
    $('#timeIn').on('change', function() {
        var numIn = $('#timeIn').timepicker(('getSecondsFromMidnight'));
        var inHours = {
            hours: (numIn/86400)*24,
            getter: function() {return this.hours;}
        };
        timeIn = $('#timeIn').val();
        inArray.push(timeIn);
        events.push(timeIn);
});
</code></pre>

<p>In this example the variables numIn &amp; inHours are only known within that onChange method, correct? If that is the case what would the global declaration look like? The 'timeIn' is globally scoped but without manipulation I only get a string representation back. What are my options for getting a computable time back as return.  </p>
