The problem of declaring a non-anonymous function in a function immediately

topic description

            var a=1;
            
            (function a(){
                console.log(1,a);
                a=2;
                console.log(2,a);
                delete a;
                console.log(3,a);
            })();
            console.log(4,a);

what exactly is the meaning of asking axi2? And why the output is the code of the a function itself?

Jun.06,2021

1, astat2; is relative to the first line of var axiom 1; and then, mainly demonstrates the scope of variables.
2, in the function expression (that is, the part of the function enclosed in parentheses), the role of an is the function itself, used for self-reference (such as recursion), is a "contaminated" variable name. The following assignments and deletions cannot operate on a because it is not a regular variable.


    a = 1
    // 
    var a = undefinded
    a = 1
    // 

so the an inside the closure is, of course, the function itself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a9d7-2c241.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a9d7-2c241.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?