hier desctructure wie Destrukturierung funktioniert:Wie ein Objekt auf diese
let o = {a:0, b:1};
let {a, b} = o;
console.log(a,b);
Wie ordne ich Eigenschaften A, B zu this
?
In einer Situation wie dieser, zum Beispiel:
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, sorry, fügte einige fehlende Teile –