The console says arr1 is not a function!

function union(arr1, arr2, arr3) {//1
 arr1 = arr1.concat(arr2).concat(arr3);
 console.log("concatenation of arr1", arr1, '\n');
  arr1 = arr1.sort();
  console.log("arr1 good ordered", arr1, '\n');
  for(i = arr1.length - 1; i > 0; i --) {//2

        for(j = i -1; j > 0; j --) {//3
      if(arr1[i] == arr1(j)) {//4
          arr1 = arr1.splice(i, 1);
         console.log("arr1 spliced", arr1);

  return arr1;

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

This type of error occurs many times and I don't definitely understand what is the problem. I know that there as methods that change arrays as splice, and some methods dont change arrays but make new arrays on the basis of other array as slice of array.
But here I give up.

1 Year
Discussion Span
Last Post by kouty

Thank's ):
I also modified "arr1 = arr1.splice(i, 1)" by" arr1.splice(i, 1") and continue to try.

Edited by kouty

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.