javascript中比较运算符示例说明


摘要:
下文通过示例的方式javascript中比较运算符的相关说明,如下所示;

比较运算符的功能:
js中比较运算符用于比较两个数的大小,
比较后,返回一个布尔值,例:

 <meta charset='utf-8' />
<p>
 maomao365.com<br />
 js比较运算符示例说明 
</p>
<hr />  
<script> 
            var a = 88;
            var b = 99;
            var newLine = "<br />";
      
            document.write("(a == b) => ");
            result = (a == b);
            document.write(result);
            document.write(newLine);
         
            document.write("(a < b) => ");
            result = (a < b);
            document.write(result);
            document.write(newLine);
         
            document.write("(a > b) => ");
            result = (a > b);
            document.write(result);
            document.write(newLine);
         
            document.write("(a != b) => ");
            result = (a != b);
            document.write(result);
            document.write(newLine);
         
            document.write("(a >= b) => ");
            result = (a >= b);
            document.write(result);
            document.write(newLine);
         
            document.write("(a <= b) => ");
            result = (a <= b);
            document.write(result);
            document.write(newLine);
        </script>
JavaScript中比较运算符的示例说明

JavaScript中比较运算符的示例说明