I'm currently working on extracting values from an array of objects based on their IDs, but I've hit a roadblock. The issue lies in the fact that I have this array of objects and I'm unsure about how to properly iterate through them. While I understand that using the .map method might solve my problem, I am still new to implementing it.
Essentially, what I want is for my method to take an ID as input and return the corresponding name value from the object containing that ID.
https://i.sstatic.net/hudWM.pngAny suggestions on how I can improve my iteration process? Currently, my approach looks like this:
getName(field_id: any): any {
var aux = 0;
var obj = this.customFields[aux].filter(function (obj) {
return obj.name === field_id;
})[0];
aux ++;
}
It seems that my iterator "aux" isn't doing its job correctly. Any help would be greatly appreciated.