If within a class constructor and I lookup an object that contains many values, how can I make it so that class will obtain all those values?
For example, if this is my object:
const myObject = {
a: 1,
b: 2,
c: 3
}
This is my class:
class MyClass {
constructor() {
const object = createMyObject(); // This function returns the above myObject
}
}
Now, how do I make it so MyClass
has all the values of myObject
so I can do something like:
const class = new MyClass();
console.log(class.a);
// 1