x=5;
y=2;
z=x+y;
运算符 | 描述 | 例子 | 结果 |
+ | 加 | x=y+1 | x=4 |
- | 减 | x=y-2 | x=1 |
* | 乘 | x=y*2 | x=6 |
/ | 除 | x=y/2 | x1.5 |
% | 求余数 (保留整数) | x=y%2 | x=1 |
++ | 累加 | x=++y | x=4 |
-- | 递减 | x=--y | x=3 |
运算符 | 例子 | 等价于 | 结果 |
= | x=y | x=5 | |
+= | x+=y | x=x+y | x=15 |
-= | x-=y | x=x-y | x=5 |
*= | x*=y | x=x*y | x=50 |
/= | x/=y | x=x/y | x=2 |
%= | x%=y | x=x%y | x=0 |
a="hello ";
b="world";
c=a+b;
var x=5+5;
var y="5"+5;
var z="Hello"+5;
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |