<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<!-- 算数运算符
+ - * / %-->
</body>
<script>
console.log(2 + 3);//5
console.log("2" + 3);//23
console.log(2 + true);//3
console.log("2" + true);//2true
console.log(2 + null); //2
console.log(2 + undefined);//NaN(Not a Number) 非数字
console.log("2" + undefined);//2undefined
// 1.当加号两侧同时为数字,加法运算
// 2.当加号任何一侧有字符串,字符串拼接
var a = 10, b = "hello";
console.log(a + b);//10hello
// 1.当加号两侧同时为数字,加法运算
// 2.当加号任何一侧有字符串,字符串拼接
// +
console.log(2 + 4);//6
console.log(2 + 4 + "=");//6=
console.log(2 + 4 + "=" + 3 + 3);//6=33
console.log(2 + 4 + "=" + (3 + 3));//6=6
// -
console.log(2 - 1);//1
console.log(2 - 3);//-1
console.log(2 - false);//2
console.log(23 - "3");//20
console.log("23" - "3");//20
console.log(2 - null);//2
console.log(2 - undefined);//NaN
console.log(2 - "abc");//NaNr
//*
console.log(2 * 1);//2
console.log(2 * 3);//3
console.log(2 * false);//0
console.log(23 * "3");//69
console.log("23" * "3");//69
console.log(2 * null);//0
console.log(2 * undefined);//NaN
console.log(2 * "abc");//NaN
//a+=1;
//a++; //a+=1 a = a + 1
// ++a;
// console.1og(a);
var a = 10;
console.log(a);//10
console.log(a++);//10
console.log(a);//11
var b = 10;
console.log(b);//10
console.log(++b);//11
console.log(b);//11
// 取余
// console.log(10 % 2);//0
console.log(10 % 3);//1
// 1.当加号两侧同时为数字,加法运算
// 2.当加号任何一侧有字符串,字符串拼接
// 一元运算符:一个运算符,一个运算子 a++ ++a
// 二元运算符:一个运算符,二个运算子 a+b a +=10
</script>
</body>
</html>