<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全局变量的用法</title>
<script type="text/javaScript">
window.onload = function(){
function fn1(){
var a = b = 2;
console.log(a);
console.log(b);
}
fn1();
console.log(b);
function fn2(n){
a = n;
console.log(a);
}
fn2(4);
console.log(a);
}
</script>
</head>
<body>
</body>
</html>
pardon110