Why is this result undifined?

var xx = 99;
function a(){
    alert(xx);
    var xx = 100;
}
a();
functionvar
Mar.18,2021

both the function declaration and the variable declaration are in advance, and the function declaration comes before the variable declaration, so the code is equivalent to:

  

variable declaration promotes to know.

Menu