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

it2022-05-05  88

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

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

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

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

转载于:https://www.cnblogs.com/KellyChen/p/9048454.html


最新回复(0)