用来把数据运算符给变量的运算符
赋值运算符 | 说明 | 案例 |
= | 直接赋值 | var usrName='我是值' |
+=、-= | 加、减一个数之后在赋值 | var age = 10;age+=5;//15 |
*=、/=、%= | 乘、除、取模 后在赋值 | var age = 2 ;age *=5;//10 |
<script>
var num = 10;
num += 10; //相当于num = num + 10
num -= 5; //相当于num = num -5
num *= 2; //相当于num = num *2
num /= 5; //相当于num = num / 5
</script>