I have a list of object below
the newlist is also dynamic and SelectID array is also dynamic
I am populating thorugh a function , now I have to iteratte and create the new list
var newList =
[
{ id : 1,name="tea",plant:"darjeeling"},
{ id : 2,name="coffee",plant:"manipur"},
{ id : 3,name="milk",plant:"nilgiri"},
{ id : 4,name="tea",plant:"assam"}
]
anaother array which has ID in common
var selectedID = [2,3];
now I have to iterate over the list of objects and update the list of objects as wherever the ID is 2 and 3 plant should be "munnar "
so how to create new list of objects "newlist" like below
var newList =
[
{ id : 1,name="tea",plant:"darjeeling"},
{ id : 2,name="coffee",plant:"munnar"},
{ id : 3,name="milk",plant:"munnar"},
{ id : 4,name="tea",plant:"assam"}
]