I found the following example in a course and I don't understand it.
This code takes two arguments, in this case two years, and returns true if 1912 is within those two years, otherwise the result is false. Example:
function yearToCheck(year) {
return function(x, y) {
return year >= x && year <= y;
}
}
const checkYears = yearToCheck(1912);
checkYears(1900, 1913) // true
checkYears(1900, 1911) // false
The code works. I just want ot undestand why does the anonymous function "function (x, y)" take the values 1900 and 1913/1911 from the variable checkYears?