Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<script>
//原始类型:1.数值类型
console.log("数值类型");
let a = 100;
console.log(typeof a);
console.log("------------");
//2.字符串类型
console.log("字符串类型");
let b = "数据类型";
console.log(typeof b);
console.log("------------");
//3.布尔类型
console.log("布尔类型");
let c = true;
console.log(typeof c);
console.log("------------");
//4. undefined类型
console.log("undefined类型");
let d;
console.log(typeof d);
console.log("------------");
//5.null类型
console.log("null类型");
let e = null;
console.log(typeof e);
console.log("------------");
//引用类型 1.数组类型
console.log("数组类型");
let f = ["1", "2"];
console.log(typeof f);
//判断一个函数是否是数组
console.log(Array.isArray(f));
console.log("------------");
//2.对象类型
console.log("对象类型");
let g = { name: "对象", password: "123456" };
console.log(typeof g);
console.log("------------");
//3.方法类型
console.log("函数类型");
function i() {}
function h() {
return typeof i;
}
console.log(h(i));
console.log("------------");
</script>
<script>
let age = 18;
if ((agr = 18)) {
console.log("这是单分支");
}
</script>
let ceshi = 5;
if (ceshi > 6) {
console.log("这是if多分支");
} else {
console.log("这是else多分支");
}
let fenzhi = 5;
if (ceshi > 6) {
console.log("这是if多分支");
} else if ((ceshi = 5)) {
console.log("这是else if多分支");
} else {
console.log("这是else多分支");
}
let yufatang = 18;
switch (true) {
case yufatang >= 19:
console.log("这是大于18时的输出");
break;
case yufatang == 18:
console.log("这是等于18时的输出");
break;
default:
console.log("这是小于18时的输出");
}
let a = 1;
while (a <= 9) {
console.log(a);
a++;
}
let a = 1;
do {
console.log(a);
a++;
} while (a <= 9);
for (let i = 1; i <= 10; i++) {
console.log("这是For循环" + i);
}
let arr = ["for-of的值1", "for-of的值2", "for-of的值3"];
for (let name of arr) {
console.log("值:" + name);
}
let obje = {
username: "新手1314",
password: "123456",
type: "确定",
};
for (let zhi in obje) {
console.log(obje[zhi]);
}