为什么这个点击后控制台显示的不是‘刘德华’,而是empty string?
<body>
<button>点击</button>
<script>
class Star{
constructor(name){
this.name = name;
this.btn = document.querySelector('button');
this.btn.onclick = this.sing;
}
sing(){
console.log(this.name);
}
}
var ldh = new Star('刘德华');
</script>
</body>