Variáveis JavaScript 'içadas'

Não entendo completamente por que as seguintes exibições "foram içadas" no final.

var x = 'set';
var y = function () 
{
    // WHAT YOU DON'T SEE -> var x; 
    // is effectively "hoisted" to this line!

    if (!x) 
    { 
        // You might expect the variable to be populated at this point...it is not
        // though, so this block executes
        var x = 'hoisted'; 
    }

    alert(x); 
}

//... and this call causes an alert to display "hoisted"
y();

Qualquer ponteiro seria apreciado.

questionAnswers(3)

yourAnswerToTheQuestion