JavaScript 比较和逻辑运算符
JavaScript 比较和逻辑运算符
比较和逻辑运算符用于测试 true 或 false。
比较运算符
运算符	|描述	
--|
==	|等于	
===	|全等(值和类型)
!=	|不等于
>	|大于	
<	|小于
>=	|大于或等于	
<=	|小于或等于
if (age<18) document.write("Too young");
逻辑运算符
 运算符  描述	例子
  &&	and	(x < 10 && y > 1) 为 true
  ||	or	 (x==5 || y==5) 为 false
   !    not	!(x==y) 为 true
条件运算符
语法
variablename=(condition)?value1:value2 
例子
greeting=(visitor=="PRES")?"Dear President ":"Dear ";
    Super
                    
                
                
            
        
浙公网安备 33010602011771号