Two JS arrays match replacement values

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}
]
Mar.09,2022

for(var i=0;i<obj1.length;iPP){
 if(obj2.indexOf(obj1[i].name)!= -1)
   obj1[i].checked = !obj1[i].must?!obj1[i].checked:true;
}

do you want to be faster or more concise?
if it's more concise, look at afishhhhh's answer
if you want to be faster, you need to reset obj2 to hash mode

.
 function isBelong(name, arr) {
       for(let i = 0; i < arr.length; iPP){
          if(name === arr[i]){
           return true;
          }
       }
       return false;
     }

       const newobj = obj1.map(item => {
         if(isBelong(item.name, obj2) && !item.must){
            return {
              ...item,
              checked: !item.checked
            }
         }
         return item;
       });
Menu