I am trying to remove duplicates from a list of arrays. The way I was trying to do this is by using reduce to create an empty array that pushes all undefined indexes onto that array. I am getting errors though that
if(acc[item]===undefined){
      ^
TypeError: Cannot read property '1' of undefined
my function below:
function noDuplicates(arrays) {
  var arrayed = Array.prototype.slice.call(arguments);
  return reduce(arrayed, function(acc, cur) {
    forEach(cur, function(item) {
      if (acc[item] === undefined) {
        acc.push(item);
      }
      return acc;
    });
  }, []);
}
console.log(noDuplicates([1, 2, 2, 4], [1, 1, 4, 5, 6])); 
     
     
     
     
     
     
     
    