I'm working on implementing static readonly in my code, but I've never done anything like this before. Here's what I currently have:
export class Names {
static readonly michael = { firstName: 'michael', secondName: 'jackson'};
static readonly john = { firstName: 'John', secondName: 'Doo'};
static readonly donald = { firstName: 'Donald', secondName: 'Trump'};
}
And I also have
name = 'michael';
What I want to achieve is to search within the Names class for a person named Michael and return their first and last name, similar to this:
found = { firstName: 'michael', secondName: 'jackson'};
For the sake of simplicity in explaining my question, let's assume all static readonly values are unique. I know how to search inside an array, but how do I search within a class?