Q:

JS using partially parametrized function

I'm very new to JS, I've tried code below :
function isBigEnough(element, index, array, threshold) {
  return (element >= threshold);
}
[1, 2, 3].every(isBigEnough(threshold=0)

I thought it doesn't work because prototype (in Array.prototype.filter()) does not contain threshold, so it is types mismatch, but we can't define like this :
    isBiggerThenZero = isBigEnough(threshold=0)
so is there nice workaround for this case ?

A:

When you do [1, 2, 3].every(isBigEnough(0)). It:

Calls isBigEnough that returns false.
Executes [1, 2, 3].every(false). Where false is not a function. SO it gives you an error. 

You can use a closure that binds threshold value to the returned function:
function isBigEnough(threshold) {
  return function(element, index, array) {
     return (element >= threshold);
  }
}
[1, 2, 3].every(isBigEnough(0))

