Using Logical AND (&&) for Short-circuit Evaluation in Javascript


Use && to execute the right-hand side expression only if the left-hand side is true.

Source Code

let loggedIn = true;
loggedIn && console.log('User is logged in');
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments