Yeah, at first it can be confusing. Just one more point to add - In case of Logical OR|| it behaves as a short circuit. So if you use expressions and your first expression becomes truthy, other expressions will never be evaluated. If there is a function call, it will not execute.
// if isUserMember() returns truthy value, isUserAuthorised() will never be calledvarresult=isUserMember(userdetails)||isUserAuthorized(userdetails);
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Yeah, at first it can be confusing. Just one more point to add - In case of
Logical OR
||
it behaves as a short circuit. So if you use expressions and your first expression becomes truthy, other expressions will never be evaluated. If there is a function call, it will not execute.Absolutely