1,js about function promotion (in ES5)
function f () {Console.log (' I am outside! ' )} (function() { if(false) {// The function f () {Console.log ("I am inside!") that declares a function in the if, loop code block is certainly not allowed in strict mode. )} }} (f (); }) (); // The result is I am inside! Because there is a variable function promotion in ES5, repeated declarations, followed by overwriting the front, so the final function is functions f () {Console.log ("I am inside!")}
Using a let declaration in ES6 produces a block-level scope without immediately executing an anonymous function.
2.
alert (a) a (); var a=3; function A () { alert (ten)} alert (a) a=6; a (); ------------Split Line------------------alert (a) a (); var a=3; var a=function() { alert (ten)} alert (a) a=6; a (); Link: https://juejin.im/post/5a0c170c6fb9a0451c39eff2
Some interesting phenomena in JS