class Animal { constructor(){ console.log(this); this.type = 'animal'
}
says(say){
setTimeout(function(){ console.log(this); console.log(this.type + ' says ' + say)
}, 1000)
}
}為什么一個this是Animal對象,一個this是window對象?
js this 問題
天涯盡頭無女友
2018-09-14 09:33:02