JSFiddle - React, Tailwind, and code Playground
JavaScript
var currentList = ['Daniel', 'Lara', 'Horst'];
var newList = ['Mario', 'Lara'];
var toDelete = [];
var toAdd = [];
for(var i=0;i<newList.length;i++){
console.log(newList[i],currentList.indexOf(newList[i]))
if(currentList.indexOf(newList[i]) >-1)
toAdd.push(newList[i])
}
for(var i=0;i<currentList.length;i++){
console.log(currentList[i],newList.indexOf(currentList[i]))
if(newList.indexOf(currentList[i]) == -1)
toDelete.push(currentList[i]);
}
console.log('dele',toDelete);
console.log('add',toAdd);