自增,自减运算++ --

自增运算++
var n=1;
n++/++n;
(n++*++n)+(n)-(++n)+(n++)=?
在运算中,凡是n++;只要在运算,n只出现一次,那么n++也就是n的初始值;
如果出现第二个n 初夏在n++之后的,那么此时的n=n+1;
++n没参与运算,就原地先加1;
自增运算一般用于递增式的程序执行;或者循环执行;
自减运算
n–先运算后减1
–n先减1后运算;

/* var a=3;
var b=4;
var c=++a+b++ +a;
a=4 +4+4
console.log©;//12
console.log(a);//4
console.log(b);//5

		*/
		/*var a=6;
		var b=3;
		var c=b++ +a-- +b+ ++a;
				3 +6   +4 +6  =19
				b=4  a=5
		console.log(c);//19
		console.log(b);//4  
		*/
		/*var a=2, b=3 , c=4;
			++a;//a=3
			a++;//
			//a=4				
			e=++a+(++b)+(c++)+a++;
				5+4+4+5	
				
			alert(e);// 18  19  20 */
			
			var a='12';
			var b=true;				
			console.log(a+b);//121 	13	string+boolean ---- 12true
			
			var c=2;				
			console.log(a+c);//122
			console.log(b+c);//3
			
			
			var foo = "11"+2-"1";//"112"-"1"---number
			console.log(foo);//111     
			console.log(typeof foo);//number
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值