&&(AND) Operator
The && operator accepts multiple arguments and evaluates the operator from left to right. It returns true only if all the operands that are evaluated are true
Example: In this example, we will perform and operation on different numbers and evaluate their output as a boolean
// &&(AND) operator
let i = 0, j=2, k=3, l=8;
console.log(Boolean(i&&j&&k));
console.log(Boolean(j&&k&&l));
Output:
false
true
Explanation: In JavaScript, the value of 0 when converted to zero is considered false so when performing “and” operation on 0 a falsy value is returned and we get false output otherwise true.
Contact Us