函数声明

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

</head>
<body>
<script type="text/javascript"> 

var n=100;

/*
f2=function(){alert(n);}
function f3(){alert(n);}
f2();//100
f3();//100
*/

function F1(){
   f2=function(){alert(n);}
  function f3(){alert(n);}
   f3();//100
}
F1();
f2();//100
f3();//未定义

</script>
</html>

 

posted @ 2016-12-10 15:37  桃小蛋  阅读(100)  评论(0编辑  收藏  举报