여기 destructuring 작동하는 방법에 개체를 desctructure합니다 :방법이
let o = {a:0, b:1};
let {a, b} = o;
console.log(a,b);
어떻게 this
에 B, 속성을 할당하는 방법은 무엇인가? 예를 들어이 같은 상황에서
class myClass {
constructror(){
this.a = null;
this.b = null;
}
myMethod(o){
//destructure o here, so that 'this' was assigned a and b
}
}
const o = {a:0, b:1};
const myInstance = new myClass();
myInstance.myMethod(o);
@AndrewLi, 죄송합니다, –