The ||
expression short circuits after the first time bind
returns true
.
The first time you evaluate
result = result || bind(...) // result is false at this point
bind
is called, because that's the only way to determine the value of false || bind(...)
. Because bind(...)
returns true
, result
is set to true
.
Every other time you say
result = result || bind(...) // result is true at this point
... the bind(...)
expression isn't evaluated, because it doesn't matter what it returns; the expression true || anything
is always true
, and the ||
expression short circuits.
One way to ensure that bind
is always called would be to move it to the left side of the ||
, or change the ||
to an &&
, depending on what you are trying to accomplish with result
.