Computer >> Computer tutorials >  >> Programming >> Javascript

What is Logical AND Operator (&&) in JavaScript?


If both the operands are non-zero, then the condition becomes true with Logical AND Operator.

Example

You can try to run the following code to learn how to work with Logical ANDOperator −

<html>
   <body>
      <script>
         var a = true;
         var b = false;

         document.write("(a && b) => ");
         result = (a && b);
         document.write(result);
      </script>
   </body>
</html>