// demo1 
function a() {}
var a 
console.log(typeof a) // function

// demo2
function a() {}
var a  = 1
console.log(typeof a) // number


console.log(typeof a) // function
function a() {}
var a  = 1
  • 函数提升和变量提升
  • 函数提升优先级高于变量提升
  • 函数提升不会被变量提升的声明覆盖

# 资料

一道经典面试题

前端经典面试题