js的表达式和运算符

 

一、赋值运算符

00ad067d8187478da41c3478375cb2ff.png

var a=10

赋值给你个变量

二、算术运算符

a1250ea839624e4f82c387ad19fb5426.png

 通过算术运算符是完成运算的符号

 var a = 11,b = 2
	console.log(a + b)  
	console.log(a - b)  
	console.log(a * b)  
	console.log(a / b) 
	console.log(a % b) 
	console.log(a++) 
	console.log(++a) 

三 结合运算符

 fcdba7be6d864168aab71f24894d4825.png

 

//结合运算符 *= /= += -= %=
	var a = 5,b = 6,c = 1,d = 2,e = 3
	//a = a+1
	a += 1
	console.log(a)
	//b = b-1
	b -= 1
	console.log(b)
	//c = c*1
	c *= 1
	console.log(c)
	//d = d/1
	d /= 1
	console.log(d)
	//e = e%1
	e %= 1
	console.log(e)

 四 比较运算符

bd6d9e570af8436eb1f49b932e76b602.png

 

绝对等于,如果操作数相等并且类型一致,则返回true。

不绝对等于,如果两个数不相等或类型不一致,则返回true。

等于如果两个操作数相等返回true。

//比较运算符
	console.log(10 =="1")
	console.log(10 !="1")
	console.log(10 >="1")
	console.log(10 <="1")
	console.log(10 ==="1")
	console.log(10 !=="1")

 五 逻辑运算符

 2e3dbe43e7a14bd3910a2586c94f55fd.png

//逻辑运算符
		var j = 1,i = 2
		console.log(!(a+b>20 || b<10))
		console.log()

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值