These are chat archives for Moose1551/JavaProblems

15th
Jun 2016
Zach
@Moose1551
Jun 15 2016 12:42
var joined = [47, 11];
var newArr = joined.filter(function(elem, index, array) { return array.indexOf(elem) === array.lastIndexOf(elem); });
Zach
@Moose1551
Jun 15 2016 12:52
function diffArray(arr1, arr2) {

  var joined = arr1.concat(arr2).sort();

  var newArr2 = joined.filter(function(elem, index, array) {
     return array.indexOf(elem) === index &&
         (arr1.indexOf(elem) === -1 || arr2.indexOf(elem) === -1);
});
return newArr2;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);