Given:
if(arr[0]!=null && arr[0].value.toString()!="") {
//do something
}
Does an if conditional statement return false immediately after the first statement fails? Or does it check the second condition regardless?
Cheers, Gavin :)
It depends. If you are checking values with AND (&&
) and the first value is false
, the condition would immediately evaluate to false
because every condition has to evaluate to true
.
If you are checking values with OR (||
) and the first condition is false
, the if statement would check every other condition until it finds a true
value.