함수 선언은 호이스팅 된다.
fn()
function fn(){console.log(111)}
결과)
111
하지만 함수표현식은 호이스팅되지 않는다.
fn()
var test = function fn(){console.log(111)}
결과)
VM794:1 Uncaught ReferenceError: fn is not defined
at <anonymous>:1:1
May 26, 2019
함수 선언은 호이스팅 된다.
fn()
function fn(){console.log(111)}
결과)
111
하지만 함수표현식은 호이스팅되지 않는다.
fn()
var test = function fn(){console.log(111)}
결과)
VM794:1 Uncaught ReferenceError: fn is not defined
at <anonymous>:1:1