Javascript filter partially op

The "filter" function returns an array [0,4], but I do not understand how this is obtained. Can you explain the "partial"? Is this a built-in function? I assume that "op" applies the ">" operator to numbers in the array. Since 5 is greater than 0, it is added to the result array. But how does "partial" work work?

function filter(test, array) {
  var result = [];
  forEach(array, function (element) {
    if (test(element))
      result.push(element);
  });
  return result;
}

show(filter(partial(op[">"], 5), [0, 4, 8, 12]));
+3
source share
1 answer

2 . f (x, y) a. g (z). g (b), f (a, b). , . , '<' 2- .

Partial - , , .

+1

Source: https://habr.com/ru/post/1795125/


All Articles