How can one pass a variable to a filter function in javascript?
In this case I'm trying to pass a value to variable "maxage":
var dateFilter = function(value,maxage) { // Age in miliseconds
if(Date.now() - value < maxage) {
return value;
} else {
return false;
}
}
dates.filter(dateFilter,500);
How can I pass the value 500 to the filter as maxage?