Merging two array of objects only when array element contains error

So I have two arrays with objects. And also an array indicating where the replacement should take place(It spots if object contains error)

         const oldData = [
    {
        "index": "01",
        "skuId": "Sarbb-033",
        "name": "Sasko Black",
        "barcode": "843331510012",
        "description": "Nice black bread",
        "brand": "ERROR: No brand matching: Sasko",
        "productLine": "ERROR: No product line matching: line",
        "inputType": "Weight",
        "uom": "ERROR: Invalid UoM type, valid values are: kg,g,mg,kl,l,ml,m,cm,mm",
        "value": "700",
        "capacity": "1",
        "image": ""
    },
    {
        "index": "02",
        "skuId": "ERROR: Empty sku_id is not allowed",
        "name": "Sasko Black1",
        "barcode": "ERROR: Empty barcode is not allowed",
        "description": "Nice black bread",
        "brand": "ERROR: No brand matching: Future Life",
        "productLine": "ERROR: No product line matching: line",
        "inputType": "Weight",
        "uom": "kg",
        "value": "701",
        "capacity": "2",
        "image": ""
    },
    {
        "index": "03",
        "skuId": "Sarbb-099",
        "name": "Sasko Black100",
        "barcode": "843332555614",
        "description": "Nice black bread",
        "brand": "fwfwf",
        "productLine": "naam",
        "inputType": "weight",
        "uom": "g",
        "value": "702",
        "capacity": "3",
        "image": ""
    },
    {
        "index": "04",
        "skuId": "Sarbb-100",
        "name": "Sasko Black101",
        "barcode": "ERROR: Empty barcode is not allowed",
        "description": "ERROR: Invalid description: [] it should not be blank.",
        "brand": "fwfwf",
        "productLine": "fwfwf",
        "inputType": "Weight",
        "uom": "g",
        "value": "703",
        "capacity": "4",
        "image": ""
    },
    {
        "index": "05",
        "skuId": "Sarbb-101",
        "name": "Sasko Black102",
        "barcode": "843332555616",
        "description": "Nice black bread",
        "brand": "fwfwf",
        "productLine": "naam",
        "inputType": "weight",
        "uom": "g",
        "value": "704",
        "capacity": "5",
        "image": ""
    }
]


    const newData = [
    {
        "index": "01",
        "skuId": "Sarbb-033",
        "name": "Sasko Black",
        "barcode": "843331510012",
        "description": "Nice black bread",
        "brand": "fwfwf",
        "productLine": "fwfwf",
        "inputType": "Weight",
        "uom": "g",
        "value": "700",
        "capacity": "1",
        "image": ""
    },
    {
        "index": "02",
        "skuId": "sarb",
        "name": "Sasko Black1",
        "barcode": "124125125",
        "description": "Nice black bread",
        "brand": "fwfwf",
        "productLine": "fwfwf",
        "inputType": "Weight",
        "uom": "kg",
        "value": "701",
        "capacity": "2",
        "image": ""
    },
    {
        "index": "03",
        "skuId": "Sarbb-100",
        "name": "Sasko Black101",
        "barcode": "214214214",
        "description": "Desc",
        "brand": "fwfwf",
        "productLine": "fwfwf",
        "inputType": "Weight",
        "uom": "g",
        "value": "703",
        "capacity": "4",
        "image": ""
    }
]

    const errorRows = [0,1,3]


      const myTerribleAttempt = oldTableData.map((oldData, rowIndex) => {
  return errorRows.map(index => {
    if(rowIndex === index){
     newTableData.map(newData => {
oldData = newData
     })
    }
  })
 })

I have tried multiple maps and just can’t seem to get the right result. The new data objects should replace old data objects at the object containing the error. Please give me some assistance.