[Js Master Road Part 1] Hundreds of JavaScript battles [new version] _15 Variable and function scope

 

normal:

var say = function(){
console.log('Hello');
}

say();

 

There is an error:

In the way of function expression, the call cannot occur before the definition, otherwise an error will be reported

Uncaught TypeError: say is not a function at 150.html:7

(anonymous) @ 150.html:7

 

say();

var say = function(){
console.log('Hello');
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325474289&siteId=291194637