avoidP2P() || t < lowBuffer || 0 === a.size(p2pManager.swarm.utils.contributors) ? requestToCDN() : requestToP2P()
If the above functions are as follows: A || B || C
Does C run?
avoidP2P() || t < lowBuffer || 0 === a.size(p2pManager.swarm.utils.contributors) ? requestToCDN() : requestToP2P()
If the above functions are as follows: A || B || C
Does C run?
It means "Get the first value from these that is not falsy", being "falsy" some of:
false
null
undefined
0
NaN
''
More info here: https://developer.mozilla.org/en-US/docs/Glossary/Falsy
In JavaScript, the ||
operator means "or". So for a function like A || B || C
:
1. JavaScript will first try to evaluate the value of A
, if it is true
, the execution will stop and B
and C
won't even get called.
2. However, if A
evaluates falsy
, then JS will execute B
. In the same manner, if B
returns true
, then execution is stopped and C
won't get called.
3. Only and only if both A
and B
evaluates false
, then JS will try C
hoping to get a true
value.
For your reference, falsy values are:
null
false
0
undefined
''
[]
{}
Hope that helps!