Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<!DOCTYPE html>
<html lang="zh-CN">
<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>js数据类型、分支、循环</title>
</head>
<body>
<script>
// 数据类型
let a='OK';
console.log(typeof a);
console.log('--------------------------');
let b=100;
console.log(typeof b);
console.log('--------------------------');
let c=['姓名','年龄','学历'];
console.log(typeof c);
console.log('--------------------------');
let d;
console.log(d);
// 分支
let age = 60;
if(age >=60){
console.log('老年人');
}
console.log('-------------------------');
let ages = 35;
if(ages >=50){
console.log('中年人');
}else{
console.log('青年人');
}
console.log('-------------------------');
let fs=75;
if(fs >=90 && fs<120){
console.log('你的分数为:A+');
}
else if(fs >70 && fs<80){
console.log('你的分数为:A');
}
else if(fs >60 && fs<70){
console.log('你的分数为:B+');
}else{
console.log('你的分数为:B');
}
const colors =['red','green','blue'];
console.log(colors);
console.log('-------------------------------------------');
// for循环方式
for(let i=0; i<colors.length; i++){
console.log(colors[i]);
}
console.log('-------------------------------------------');
// for-in循环方式
for(let item in colors){
console.log(item+':'+colors[item]);
}
console.log('-------------------------------------------');
// for-of 循环方式
for(let item of colors.values()){
console.log('颜色:'+ item);
}
console.log('-------------------------------------------');
for(let item of colors.keys()){
console.log('键值:'+ item);
}
console.log('-------------------------------------------');
for(let item of colors.entries()){
console.log('键值+颜色:' + item);
}
</script>
</body>
</html>