i have below object structure like as in below image and i am trying to match with the inner object property(like massing type id) with the existing ID and if it is match i need to get the name of that object and push it to array and set that array in state object,
and the code is looks like as below
Object.values(constructionSets).forEach(item => {
console.log(item);
const constructionSetItem = [];
if (
item.ashraeClimateZone?.id === ashraeClimateZoneId &&
item.massingType?.id === massingTypeId &&
item.sourceOfData?.id === energyCodeId
) {
setConstruction(constructionSetItem.push(item.name));
}
});
and when i log item i am getting array of objects instead of single object, could any one please let me know where i am doing wrong with the above code?
thanks in advance.

constructionSetsvalue passed into.values()?constructionSetsappears is already an array, soObject.values(constructionSets)should return back an identical array and theconsole.log(item);is log of each object.