I am trying have a class that restructures the parameters passed to the constructor in a way that is not just assigning it to its own this
instance, so that:
class Test {
constructor(a, b, c){
this.a = a;
this.dict = { b: b, c: c };
}
}
The instance is built from an ajax query via Object.assign
which passes the a, b, c.
unfortunately this doesn’t seem to work, and I get it instead initialized this way:
Test{
a:a, // works obviously
b:b, // wrong
c:c, // wrong
dict:{a: undefined,b:undefined} // wrong
}
What am I misunderstanding about how to use constructors here?