码迷,mamicode.com
首页 > 编程语言 > 详细

javascript的函数声明提前例子

时间:2014-10-04 13:44:56      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   java   sp   div   c   on   

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}

javascript的函数声明提前例子

标签:style   blog   color   io   java   sp   div   c   on   

原文地址:http://www.cnblogs.com/nozero/p/4005755.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!