function a() {} vs. var a=function(){} vs (function a(){})

1. Javascript 函数和变量声明的“提前”hoist 行为

2. var a=function(){} 函数名a提前了,函数主体body不会被提前,只有在被调用时才被初始化

3. 为什么会出现这种情况? js编译的顺序是怎样的?

answer: http://dmitrysoshnikov.com/ecmascript/chapter-2-variable-object/#introduction

posted on 2018-05-16 22:01  KellyChen_hug&hope  阅读(151)  评论(0)    收藏  举报

导航