If I have a class with a constructor and in the constructor an array with objects and I want an object method to edit the values of the objects, it gets kind of messy.
This is what I'm kind of aiming for:
class SomeClass {
constructor() {
this.o = [
{
name: "John",
changeName: () => {
this.name = "Mike";
},
},
];
}
}
SomeClass.o[0].changeName();
But that doesn't work because the this refers to the class and not the object.