Not sure how do to this, so any help is greatly appreciated
Say I have :
const array1 = [1, 1, 2, 3, 4]; const array2 = [1, 2];
Desired
var array1 = [1, 1, 2, 3, 4], array2 = [1, 2], result = array1.slice(0); array2.forEach(function(element) { var index = result.indexOf(element) if (index >= 0) { result.splice(index, 1) } }) console.log(result)