JavaScript 逻辑运算符


JavaScript 逻辑运算符

<html>
   <body>
      <script>
         <!--
            var a = true;
            var b = false;
            var linebreak = "<br />";
            document.write("(a && b) => ");
            result = (a && b);
            document.write(result);
            document.write(linebreak);
            document.write("(a || b) => ");
            result = (a || b);
            document.write(result);
            document.write(linebreak);
            document.write("!(a && b) => ");
            result = (!(a && b));
            document.write(result);
            document.write(linebreak);
         //-->
      </script>
      <p>Set the variables to different values and different operators and then try...</p>
</body>
</html>