JS的运算符
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
var x = 10
// var ret = x++ // x +=1 // x = x+1 //先赋值再计算
var ret = ++x // x +=1 // x = x+1 //先计算再赋值
console.log(x) // 11
console.log(ret) // 11
// 逻辑运算符
console.log(2>1 && 2==="2") // false
console.log(2>1 || 2==="2") // true
var a = 100;
var b = 20;
console.log(a>b?a:b) // 100 #输出最大的变量值
</script>
</head>
<body>
<h1>welcome to JS!</h1>
</body>
</html>
![](https://img2022.cnblogs.com/blog/1413093/202206/1413093-20220602211316603-2111998547.png)