I never really got the reason for doing this
var condn = ...;
if (condn) {
return true;
}
return false; var condn = ...;
if (condn) {
return true;
}
return false;Oh, sorry, didn't see the !
The strange part is testing Boolean value... to return the same value as Boolean constants.
Why wasn't the Boolean result simply returned directly?
var condn = ...;
return condn;
The if statement isn't necessary. Even if you wanted to explicitly return only "true" or "false" - using the if statement to convert truthy and falsy results into true booleans - using double not operators removes q potentially mispredicted branch. var condn = ...;
return !!condn;