Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:
<!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>Document</title>
</head>
<body>
<script>
//1.模板字面量>表达式潜入字符串 使用反引号声明字符串内容即可
// let name = "朱老师";
// let str = "hello" + name;
// console.log(str);
// let mk = `Hello${name}`;
// console.log(mk);
//模板字面量>表达式潜入字符串 使用反引号声明字符串内容即可
//**案例 通过数组控制html输出且写入dom
// let menus = ["首页", "Video", "Article"];声明数组
// let htmStr = ` 使用模板字面量声明代码并用数组替换加载内容
// <nav>
// <a href="">${menus[0]}</a>
// <a href="">${menus[1]}</a>
// <a href="">${menus[2]}</a>
// </nav>
// `;
// console.log(htmStr);输出html代码
// document.body.insertAdjacentElement("beforEnd", htmStr);把html代码写入body页面
//**案例 通过数组控制html输出且写入dom
//2.标签函数,自定义模板字面量的一些行为
let hello = function (x) {
alert(x);
};
hello("牛逼666");
hello`wwww`;
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
// 1:赋值
let a = 1;
let b = a;
console.log("a = %d , b = %d", a, b);
// 占位符格式化输出:%s字符串 %d十进制 %o八进制 %x十六进制 %f浮点数 %e/E科学记数法 %转义字符
// 在字符串中使用上述占位符进行书写,在输出最后用逗号分隔填充变量,最终控制台输出时为变量
// a = %d b = %d ,a,b 演示
// 2:值传递
a = 2;
//a=2只是a等于2,b已经在第13行赋值了,20行并未刷新d
console.log("a = %d , b = %d", a, b);
// 3.引用传递,适用于引用类型,对象,数组
let obj = {
ID: "kowal",
Name: "tyler",
};
console.log("obj1=%o", obj);
let obj2 = obj;
console.log(obj2);
// console.log(obj2 === obj);
// 更新obj成员
obj.ID = 10;
console.log(obj2);
// 4.传参 始终是值传递
// const F1 = (x) => (x = 10);
// const F1 = function (z) {
// x = z;
// };
// F1("asdasdd");
// alert(x);
const F1 = (x) => ((c = x), (bn = 6));
F1(10);
console.log(c, bn);
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
// 数组的声明与对应变量赋值
// let shuzu = [1, 2, 3, "撒大苏打撒旦"];
// console.log(shuzu);
// let a = shuzu[0];
// let b = shuzu[1];
// let c = shuzu[2];
// console.log(a, b, c);
// 解构写法
// let [a, b] = [1, 2, 3];
// console.log(a, b);
// 全部拿到
// [a, b, c, ...d] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
// console.log(typeof d);
// console.log(typeof c);
//只拿第7个值
// [, , , , , , , , , , v] = [10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
// console.log(v);
let a = 1,
b = 2;
[b, aa] = [a, b];
console.log(aa, b);
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
//常规对象定义
let Object_First_One = {
a: 1,
b: 2,
c: 3,
};
a = Object_First_One.a;
b = Object_First_One.b;
c = Object_First_One.c;
console.log(a, b, c);
// 对象解构
({ id, name } = { id: 40541, name: "电脑" });
console.log(id, name);
//数组传参
// let Sum = function ([a, b]) {
// return a + b;
// };
// console.log(Sum([10, 80]));
// 箭头函数+数组传参
// let Sum = ([a, b]) => a + b;
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
let score = 64;
if (score >= 60) {
console.log("及格");
}
if (score >= 0 && score <= 68) {
console.log("不及格");
} else {
("优秀");
}
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
let score = 64;
if (score >= 60) {
console.log("及格");
}
if (score >= 0 && score <= 68) {
console.log("不及格");
} else {
("优秀");
}
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
let count = 60;
switch (true) {
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
case count >= 60 && count <= 75:
console.log("合格");
breake;
}
</script>
</body>
</html>
<!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>Document</title>
</head>
<body>
<script>
let status = "super";
switch (status) {
case "super":
console.log("成功");
break;
case "error":
console.log("失败");
break;
}
</script>
</body>
</html>