函数声明方式差别
1.function 函数名() 2.var 变量名 = function() 3. new Function()
如果要明白函数声明的方式不一样,就必须要搞懂js的变量提升,
函数提升会先于变量提升,切不会被未赋值的同名变量覆盖
var hello = function hello(){
console.log('嘻嘻')
}
function hello(){
console.log('哈哈')
}
hello()//嘻嘻
hello()//哈哈
var hello = function hello(){
console.log('嘻嘻')
}
function hello(){
console.log('哈哈')
}