I need assistance in checking which properties from an array are present in another array of objects and which ones are not.
My object structure is as follows:
var tempObj=[{id: '1', color: 'red, blue, green', age: 27},{id: '2', color: 'black, orange, yellow', age: 75}];
var tempColor = ['red', 'yellow', 'white'];
The tempColor array consists of three elements that I need to check against the tempObj. However, the color property values in tempObj are comma-separated, creating some confusion for me. Usually, for a single element check, I would do something like this
var eleExists= this.tempObj.findIndex(obj => obj.age === 27) >= 0;
However, when dealing with array elements and comma-separated values, I am unsure how to properly check them. I am seeking guidance or advice on how to approach this issue.