I have an Array of Objects:
reviewers = [
{
id: ''
},
{},
{}
]
Each of these objects is homogeneous (with several other keys except the 'id' one). I also have a single Object, with the following structure:
reviewerCounters = {
12345678: 3,
12312312: 2,
14234234: 0
}
The idea is that in the second object, I have the value of the property 'id' ( id - value) The length of the object is always the same as the length of the reviewers array.
I need a function that takes the value of each ID on the second object, and outputs that value in the new property 'Counter' in each object of the first array, the ID of which matches the ID of the taken value.
Thus, the ouput would be :
reviewers = [
{
id: '12345678',
counter: '3'
},
{},
{}
]
What would be the best way to achieve this?