I have a constructor like this
class Class1 {
constructor(name, age, sports,){
this.name = name;
this.age = age;
this.sports = sports
}
}
Where I recieve arguments like this:
const robert = new Class1('robert',26,{rugby: good, tenis: bad})
that I want to add to the properties and I cant figure it out how to do it
This is how it should look:
this.name = robert;
this.age = 26;
this.sports = {rugby: good, tenis: bad}
Help will be apreciated