01-算数运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>算术运算符title>
<script>
console.log(1 + 1);
console.log(1 - 1);
console.log(1 * 1);
console.log(1 / 1);
console.log(4 % 2);
console.log(5 % 3);
console.log(3 % 5);
console.log(0.1 + 0.2);
console.log(0.07 * 100);
var num = 0.1 + 0.2;
console.log(num == 0.3);
script>
head>
<body>
body>
html>
02-表达式和返回值
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>表达式和返回值title>
<script>
console.log(1 + 1)
var num = 1 + 1;
script>
head>
<body>
body>
html>
03-前置递增运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>前置递增运算符title>
<script>
var num = 1;
num = num + 1;
num = num + 1;
console.log(num);
var age = 10;
++age;
console.log(age);
var p = 10;
console.log(++p + 10);
script>
head>
<body>
body>
html>
04-后置递增运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>后置递增运算符title>
<script>
var num = 10;
num++;
console.log(num);
var age = 10;
console.log(age++ + 10);
console.log(age);
script>
head>
<body>
body>
html>
05-递增运算符练习
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>递增运算符练习title>
<script>
var a = 10;
++a;
var b = ++a + 2;
console.log(b);
var c = 10;
c++;
var d = c++ + 2;
console.log(d);
var e = 10;
var f = e++ + ++e;
console.log(f);
script>
head>
<body>
body>
html>
06-比较运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>比较运算符title>
<script>
console.log(3 >= 5);
console.log(2 <= 4);
console.log(3 == 5);
console.log('pink老师' == '刘德华');
console.log(18 == 18);
console.log(18 = '18');
console.log(18 != 18);
console.log(18 === 18);
console.log(18 === '18');
script>
head>
<body>
body>
html>
07-逻辑运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>逻辑运算符title>
<script>
console.log(3 > 5 && 3 > 2);
console.log(3 < 5 && 3 > 2);
console.log(3 > 5 || 3 > 2);
console.log(3 > 5 || 3 < 2);
console.log(!true);
console.log(!false);
script>
head>
<body>
body>
html>
08-逻辑运算符练习
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>逻辑运算符练习title>
<script>
var num = 7;
var str = '我爱你~中国~';
console.log(num > 5 && str.length >= num);
console.log(num < 5 && str.length >= num);
console.log(!(num < 10));
console.log(!(num < 10 || str.length == num));
script>
head>
<body>
body>
html>
09-逻辑中断(短路运算)
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>逻辑中断(短路运算)title>
<script>
console.log(123 && 456);
console.log(0 && 456);
console.log('' && 1 + 2 && 456 * 56789);
console.log(123 || 456);
console.log(123 || 456 || 456 + 123);
console.log(0 || 456 || 456 + 123);
var num = 0;
console.log(123 || num++);
console.log(num);
script>
<body>
body>
html>
10-赋值运算符
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documenttitle>
<script>
var num = 10;
num += 5;
console.log(num);
var age = 2;
age *= 3;
console.log(age);
script>
head>
<body>
body>
html>
11-运算符优先级
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>运算符优先级title>
<script>
console.log(4 >= 6 || '人' != '阿凡达' && !(12 * 2 == 144) && true)
var num = 10;
console.log(5 == num / 2 && (2 + 2 * num).toString() === '22');
script>
head>
<body>
body>
html>