<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var a={
af:function(){
console.log(this);
},
b:{
bb:function(){
console.log(this);
}},
c:{
cc:{
cccf:function(){
console.log(this);
}
}
}
}
a.b.bb();//这里this指向的时b
a.b.bb.call(Window);//this指向的是Window
a.b.bb.call(a);//this指向的时a</script>
</head><body>
</body>
</html>
时间: 2024-10-08 15:05:53