I have a list of contacts from two arrays. Some of the elements maybe the same, but I need to know which array has unique values and keep those unique values in that array. In other words, I want to track the unique values from which array they came from. This is my spaghetti code that I have so far:
for (var i = 0; i < emailNews.length; i++)
{
for (var j = 0; j < emailHealth.length; j++)
{
if (emailNews[i] == emailHealth[j]) {
$('#userList').append(descriptionNews[i] + '<td><span style="margin-right: 5px;">Advanced</span><input type="checkbox" name="advanced" id="advancedCheck" checked></td><td><button type="button" class="btn btn-danger btn-sm btn-user-delete" id="' + userLogin + '" >Delete</button></td></tr>');
} else {
console.log(descriptionHealth[j]);
$("#userList").append(descriptionHealth[j] + '<td><button type="button" class="btn btn-danger btn-sm" id="deleteEnd">Delete</button></td></tr>');
}
}
}