Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript && operator

// The logical AND (&&) operator for a set of boolean operands will be true if 
// and only if all the operands are true
                 
const a = 3;
const b = -2;
console.log(a > 0 && b > 0); // false

// Logical AND (&&) evaluates operands from left to right, 
// returning immediately with the value of the first falsy
             
const a = 3; // a -> truthy
const b = 0; // b -> falsy
console.log(a && b ); // 0
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #operator
ADD COMMENT
Topic
Name
2+8 =