[Solved] Combine Array Of Strings With String


const loginUser = "[email protected]"

const old = [
  {
    "toAddresses": ["[email protected]", "[email protected]"],
  },
  { 
    "fromAddress": "[email protected]",
    "toAddresses": ["[email protected]", "[email protected]"],
  }
];

let last = old[old.length - 1];
let combined = new Set([last.fromAddress, ...last.toAddresses]);
combined.delete(loginUser);
let newResponse = Array.from(combined);
console.log({newResponse});

solved Combine Array Of Strings With String