JavaScript: When a variable is declared in a function

    var aVar = 1.618 ;
    function variableLocation(){
        try{
            console.log( aVar ); // ???
        }catch( e ) {
            console.log(e.message ); // ???
        }
        var aVar = 'Golden Ratio';
    }
    variableLocation();
The output for line 4 is undefined, neither 1.618 or Golden Ratio. The line 6 is never triggered. So, var aVar = 'Golden Ratio' can be seen as two statements. (1) var aVar; which is moved to the very beginning of the function, and aVar = 'Golden Ration'; stays where it is.