Greetings, I currently have an array and an array of objects.
const factArr = ['743156', '743157']
[
{
"id": null,
"name": null,
"adsFactId": "743156"
},
{
"id": null,
"name": null,
"adsFactId": "743157",
},
// other object data here...
]
I am looking to verify if the values in factArr
exist within this object, matching the adsFactId
. If they do, I want to add two new properties to that object:
checked:true, checkBoxPatched: true
Hence, the desired output should be:
[
{
"id": null,
"name": null,
"adsFactId": "743156",
"checked": true,
"checkBoxPatched": true
},
{
"id": null,
"name": null,
"adsFactId": "743157",
"checked": true,
"checkBoxPatched": true
}
// along with other objects
]
Is there a way we can accomplish this task?