JS案例:赋值运算符使用示例

来自CloudWiki
跳转至: 导航搜索
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>赋值运算符测试示例</title>
</head><body><pre>
<script type="text/javascript">
		var a=5,b=6;
		document.writeln("a=5,b=6");
		document.writeln(" ");
		document.write("a+=b="); a+=b; document.writeln(a);
		document.write("a-=b="); a-=b; document.writeln(a);
	    document.write("a*=b="); a*=b; document.writeln(a);
		document.write("a/=b="); a/=b; document.writeln(a);
		document.write("a%=b="); a%=b; document.writeln(a);
</script>
</pre></body></html>