JavaScript hoisting function vs function variable

前端 未结 4 948
礼貌的吻别
礼貌的吻别 2021-01-22 17:34

Here is my javascript code :

    console.log(a);
    c();
    b();            
    var a = \'Hello World\';
    var b = function(){
        console.log(\"B is ca         


        
4条回答
  •  误落风尘
    2021-01-22 18:23

    At the time you are calling b is not defined yet. Your b is a variable which contains function, and the time you are accessing b it has not been defined yet.

提交回复
热议问题