About the function name of a named function expression

the front-end rookie asks everyone to help analyze this code:

 b = function a() {
    a = 10;
    console.log(a);
 }
 b();

Why does the a = 10 in the function not work?

Thank you!

Jul.30,2021

the name of the naming function expression NFE exists in an auxiliary special object (auxiliary special object) and is read-only, so modification in non-strict mode will silently fail. If this function runs in strict mode, it will report an error Uncaught TypeError: Assignment to constant variable.


in strict mode
Uncaught TypeError: Assignment to constant variable.
seems to be unmodifiable

.
Menu