标签:obj body log this window utf-8 oct javascrip htm
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
function fo(){
var i = 0;
return function(n){
return n+i++;
}
}
var f=fo();
var a =f(15);
var b =fo()(15);
var c = fo()(20);
var d = f(20);
console.log(a);
console.log(b);
console.log(c);
console.log(d);
var number = 2;
var obj ={
number :4,
fnl :(function(){
this.number*=2;
number=number*2;
var number=3;
return function(){
this.number *=2;
number*=3;
alert(number);
}
})(),
db2:function(){this.number*=2}
};
var fn1 =obj.fn1;
alert(number);//问这个会弹出什么结果
fn1();//这个会弹出什么
obj.fnl(); //这次会弹出什么
alert(window.number);//这次会弹出什么
alert(obj.number);//这次会弹出什么
</script>
</body>
</html>
标签:obj body log this window utf-8 oct javascrip htm
原文地址:http://www.cnblogs.com/zzzzzzzsy/p/6667101.html