javascript作业,求解 130
2个回答
展开全部
1.
let a = 9;
let b = 6;
let c = 5;
let d = 10;
let min1,min2,min3;
if (a >= b) {
min1 = b;
} else {
min1 = a;
}
if (c >= d) {
min2 = d;
} else {
min2 = c;
}
if (min1 < min2) {
min3 = min1;
} else min3 = min2;
alert(`${a} ${b} ${c} ${d}四个数中最小值为${min3}`);
2.
let money = 5;
let product = 6;
if (money > product) {
alert("小男孩能买到酱油")
} else {
alert("小男孩不能买到酱油");
}
3.
let temp = 39.6;
let results = "";
if (temp < 36.5) {
results = "体温偏低";
} else if (temp > 36.5 && temp < 37.5) {
results = "体温正常";
} else {
results = "体温偏高";
}
alert(`您的体温是:${temp}°\n检测结果为:${results}`);
4.
let age = 20;
let names = "jackson";
let result;
if (age >= 0 && age <= 6) {
result = "童年";
} else if (age >= 7 && age <= 17) {
result = "少年";
} else if (age >= 18 && age <= 40) {
result = "青年";
} else if (age >= 41 && age <= 65) {
result = "中年";
} else {
result = "老年";
}
alert(`${names}${age}岁正处于${result}时期`);
5.
let date = new Date().getMonth() + 1;
let str;
switch (date) {
case 12:
case 1:
case 2:
str = "冬季";
break;
case 3:
case 4:
case 5:
str = "春季";
break;
case 6:
case 7:
case 8:
str = "夏季";
break;
case 9:
case 10:
case 11:
str = "秋季";
}
alert(`现在是${date}月\n当前月份属于${str}`);
求采纳!
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询