尼龙腰带过硬:javascript中的 " /="

来源:百度文库 编辑:神马品牌网 时间:2024/07/18 16:45:35
在javascript里面,为什么当a=3, b=2时
a/=b会等于3的?

你是不是搞错了,你运行一下下面这个代码,绝对是1.5

<script language="javascript" type="text/javascript">
a=3;
b=2;
a/=b;
document.write(a);
</script>

a/=b等价a=a/b