javascript的函数声明提前例子

时间:2014-10-04 13:44:56   收藏:0   阅读:208
1 f=function(){return true;};
2 g=function(){return false;};
3 (function(){
4     if(g()&&[]==![]){
5             f=function f(){return false};
6             function g(){return true;}
7     }
8 })();
9 alert(f());


这是前端群遇到的一道题目,很精致小巧,主要是考察声明提前。if(g()&&[]==![])这里g()调用的是下面的function g(){return true}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!