JavaScript compilation only checks whether there is any code error and does not run the code. You can try
Defining a function in JavaScript can be written in two ways:
Function ftn () {}// first var ftn = function () {}// second
Some people say that these two methods are completely equivalent. However, before parsing, the previous write method will be automatically promoted to the Code header by the parser, which violates the principle defined and used by the function. Therefore, when defining a function, we recommend that you, all adopt the latter method.
After reading this sentence, I first felt that the two statements were completely consistent during use, but they were resolved differently. However, his explanation "the previous writing method will be automatically promoted to the Code header by the parser" left me confused.
If I have the following first test: