标签:
<script>
//this指向的是最终调用它的那个对象
//this指向的是window
function aa(){
var str = ‘jack‘;
console.log(this.str); //undefined
console.log(this); //window
}
window.aa();
//this指向的是bb
var bb = {
str : ‘jack‘,
show : function(){
console.log(this.str); //jack
}
}
window.bb.show();
</script>
标签:
原文地址:http://www.cnblogs.com/wenxiangxu/p/5704220.html