title: Recursive function for symmetric difference
body: <p>i made a function to calculate de symmetric difference between  arrays passed as arguments. I did it for two arrays and it worked. The problem now is that i want to extend the function to n variables. I think that i should calculate the symm difference if the arguments.length of the function   is equal to two, else i should call a recursive function to calculate the symm diff between the other elements and the first two ? I don't know, i'm very confused.</p>
  
  <pre><code>function sym(args) {
  
    var arr=[].slice.call(arguments);
    var cnts={};
    var result=[];
  
    if(arguments.length==2){
  
      arr=arguments[0].concat(arguments[1]);
      console.log(arr);
      for(var number in arr){
  
        if(cnts.hasOwnProperty(arr[number])){
  
           ++cnts[arr[number]].cnt;
  
         }
  
        else   cnts[arr[number]]={cnt:1,val:arr[number]};
  
       }
  
       for(var counts in cnts){
  
          if(cnts[counts].cnt===1) result.push(cnts[counts].val);
  
        }
  
      }
  
      else{  
  
        var first=arguments[0];
        var nextDiff=function(next){
  
          return ...........?????????;
  
        }; 
  
       }  
  
    return result;
  }
  
  sym([1, 2, 5], [2, 3, 5], [3, 4, 5]);
  </code></pre>