JS function declaration in three ways:
Function expression: function operator to create functions, expressions can be stored in variables or object properties in the anonymous function is often called, console.log (h.name); you can see the print empty '. "
Function declaration: named function, and its function can be called anywhere in scope, its function is to create a named function, you can prove it console.log (h.name); see print as "h" . this function can be later assigned to a variable code by the function name or an object property
- Function () constructor: not recommended for this use, easy to go wrong
var a = h
function h(){
console.log(1)
}
console.log(a) // ƒ h(){}