'Is there a way to pass and additional parameter through a filter?

I am filtering a range based on a condition. The condition is not always the same so I wanted to add is as a parameter to my filter function. My error comes when I call the custom filter function while passing through my additional it no longer looks at each individual item in the array and instead just the whole array.

function myFunction() {
  var arr = [[1, 3, 1], [2, 3, 1], [1, 3, 2]];
  myInt = 1;

   return arr.getValues().filter(isMyInt(arr.getValues(), myInt));
}

function isMyInt(arr, myInt) {
  return arr[0] == myInt;
}

In this example my desired result would be [[1, 3, 1], [1, 3, 2]].



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source