2.16.JavaScript--函数作用域

 

函数作用域与变量作用域差不多

 

参考变量作用域

 

http://www.cnblogs.com/xiaozhanga4/archive/2012/03/04/2379186.html

 

 

<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>2.16.JavaScript.函数作用域</title>
</head>
<body>
	<script type="text/javascript">
		/*
		var func = function(){
			document.write("1 ");
		}
		func();
		var func = function(){
			document.write("2");
		}
		func();
		*/
		
		function func(){
			document.write("3 ");
		}
		func();
		function func(){
			document.write("4");
		}
		func();
		
	</script>
</body>
</html>
posted @ 2012-03-15 21:25  校长阿四  阅读(146)  评论(0编辑  收藏  举报