I am having 2 array lists from which i am finding the difference.
arr1 = ['Sam','Annie', 'Margorie', 'Ester', 'John'];
arr2 = ['Bill', 'Sally', 'Sam', 'Annie', 'Suman', 'Margorie', 'Ester', 'Pierre', 'John'];
var diff = arr2.filter(x => !arr1.includes(x));
console.log(diff) //result....diff = ['Bill', 'Sally', 'Suman', 'Pierre']
What i want to do is to modify the above Filter Arrow function to add 'New' for each item' so that the resultant array becomes:
//diff = [['Bill', 'New'] , ['Sally', 'New'] , ['Suman', 'New'] , ['Pierre' , 'New']]
I can do this separately using a Map Arrow function like this:
diff = diff.map(x => [x,'New']);
But i want to club both these functions together. Is that possible?
Also, when i try to append this array to the last row of the sheet, the last row shows 'Object@xxx' instead of the actual values.
e.g.
Sht.appendRow(diff);
What am i doing wrong?