1 回答

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
設(shè)a=8
1."=":賦值運(yùn)算符, 例子:b=a 結(jié)果為8
2."==":比較運(yùn)算符等于,例子:a==12 結(jié)果為false
3."===":比較運(yùn)算符全等(值和類型),例子:a===8 結(jié)果為true,a==="8"結(jié)果為false
把下面代碼復(fù)制到html里面試試吧
<!doctype html>
<html>
<head>
<title>==</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
</head>
<body>
<script>
var a=8;
b = a;
document.write("=演示b=a b的值為:");
document.write(b);
document.write("<br/><br/>");
document.write("==演示a==7 比較結(jié)果為");
document.write(a==7);
document.write("<br/><br/>");
document.write("===演示a===8 比較結(jié)果為:");
document.write(a===8);
document.write("<br/>===演示a==='8' 比較結(jié)果為:");
document.write(a==='8');
</script>
</body>
</html>
添加回答
舉報(bào)