function fn(a, c){
    console.log(a)
    var a = 123
    console.log(a)
    console.log(c)
    function a(){}
    if (false) {var d = 678
    }
    console.log(d)
    console.log(b)
    var b = function (){}
    console.log(b)
    function c(){}
    console.log(c)
}
fn(1.2)
Copy the code
// The variable object that generates JS in the function scope creation stage is also called the AO object, which is accessed by the JS engine. // 1 creates the AO object. // 2 finds the declaration of parameters and variables // 4 Find the function declaration. If the function declaration name and the variable declaration name are the same, the variable declaration will be overriddenCopy the code
AO: {
    a: undefined 1 function a(){}
    c: undefined 2 function c(){}
    d: undefined
    b: undefined
}
Copy the code
// the js interpretation is executed line by line
function fn(a, c){
    console.log(a) // function a(){}
    var a = 123
    console.log(a) / / 123
    console.log(c) // function c(){}
    function a(){}
    if (false) {var d = 678
    }
    console.log(d) // undefined
    console.log(b) // undefined
    var b = function (){}
    console.log(b) // function (){}
    function c(){}
    console.log(c) // function c(){}
}
fn(1.2)
Copy the code

Refer to the video