腾讯的一道JavaScript面试题

 

//题目:分别弹出什么内容?
<!--  
function test(){  
    this.a = 1;  
    alert(this);   //[object Window]
}  
test();  
  
var t = new test();  //[object Object]

alert(a);  //1
//-->

从CSDN看到的,分享一下微笑this

txt

相关文章
相关标签/搜索