js中程序員的迷茫,this的歸屬問題

this在js編程中經常遇到,新手會對this的歸屬有些迷茫,其實很簡單,this的指向就是它的調用對象。 this的歸屬問題 //控制檯 this.x=3; x//3; window.x//3; 此時的this就是指window,調用x,其實就是調用window.x。 function d(){this.me=123;this.na=function(){console.log('this:'+
相關文章
相關標籤/搜索