how can I match the values in two arrays
var obj1 = [
{name: "", checked: true, must: true},
{name: "", checked: true, must: true},
{name: "2"}
{name: "3"}
{name: "4"}
]
var obj2 = ["","","2","4"]
the value of matching obj2 should correspond to the value of name in obj1. If checked is true, set it to false,
, otherwise it will be the opposite. But if must is true in the object, checked should keep the ture unchanged. Is there any way for
not to use double loops?
finally get the result:
[
{name: "", checked: true, must: true},
{name: "", checked: true, must: true},
{name: "2", checked: true}
{name: "3"}
{name: "4", checked: true}
]