===,需要两个变量的值和数据类型均相同,才会返回true
!==,只要变量值或者数据类型至少一个不相同,就会返回true 支持{:10_281:} 还有这奇葩东西 === !=={:10_277:} 忘了交作业了{:9_240:}
本帖最后由 xiaohai 于 2017-8-8 21:28 编辑
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>比较运算符</title>
</head>
<body>
<script type="text/javascript">
var x=3;
document.write('x>="5"的结果:'+(x>="5")+'<br><br>');
document.write('x===="3"的结果:'+(x==="3")+'<br><br>');
document.write('x!=="5"的结果:'+(x!=="5")+'<br><br>');
document.write('x!="3"的结果是:'+(x!="3")+'<br><br>');
</script>
</body>
</html>
{:5_91:} 要了解熟悉运算符~ {:10_266:}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>比较运算符</title>
</head>
<body>
<script type="text/javascript">
document.write("3>1的结果是:"+(3>1)+"<br>");
document.write("3>=3的结果是:"+(3>=3)+"<br><br><br>");
document.write("8!=8结果是:"+(8!=8)+"<br>");
document.write("8!=='8'结果是:"+(8!=='8')+"<br>");//类型不同
document.write("8!==3结果是:"+(8!==3)+"<br>");//值不同
document.write("8!='8'结果是:"+(8!='8')+"<br><br><br>");
document.write("8=='8'结果是:"+(8=='8')+"<br>");
document.write("8==='8'结果是:"+(8==='8')+"<br>");
</script>
</body>
</html> 学习了{:10_333:} 注意!==和 != 对应的是 === 和 ==
页:
[1]