Referencing a JavaScript value before it is declared - can someone explain this

前端 未结 3 1009
予麋鹿
予麋鹿 2020-11-27 16:31

I\'m hoping someone can explain to me why the below JavaScript/HTML will show \"door #2\" when the HTML is viewed in a browser:



        
3条回答
  •  醉梦人生
    2020-11-27 16:59

    function testprint is global to the page. the testprint = function... assigns a variable, that I'm not sure exactly the entire scope of, but I get the idea that it's not added to the function table dictionary the way the first one is.

提交回复
热议问题