为什么我的警报在我的 if 语句之后不起作用?
Why won't my alerts work after my if statements?
我一直在尝试让我的警报在用户输入他们输入他们的讲座代码后弹出,但我无法弄清楚发生了什么。
顺便说一句,感谢您的宝贵时间!
let employeenum, firstname, surname, hours, employeecode, lecturecode
employeenum = parseInt(prompt("Please enter your Employeer Number"));
firstname = prompt("Please enter your first name");
surname = prompt("Please enter your surname");
hours = parseInt(prompt("Please enter the amount of hours worked"));
employeecode = prompt("Please enter your employee code");
if (employeecode == "L" || employeecode == "l") {
lecturecode = parseInt(prompt("Please enter your Lecturer Qualification Code"))
if (lecturecode == "M" || lecturecode == "m"){
alert("Your Pay per Hour is 5 with a teaching allowance of 00 per month");
}
else if (lecturecode == "B" || lecturecode == "b"){
alert("Your Pay per Hour is 5 with a teaching allowance of 50 per month");
}
}
你在 lecturecode 上有一个 parseInt,但正在使用一个 if 语句来寻找一个字母。
lecturecode = prompt("Please enter your Lecturer Qualification Code")//you had parseint here
我一直在尝试让我的警报在用户输入他们输入他们的讲座代码后弹出,但我无法弄清楚发生了什么。
顺便说一句,感谢您的宝贵时间!
let employeenum, firstname, surname, hours, employeecode, lecturecode
employeenum = parseInt(prompt("Please enter your Employeer Number"));
firstname = prompt("Please enter your first name");
surname = prompt("Please enter your surname");
hours = parseInt(prompt("Please enter the amount of hours worked"));
employeecode = prompt("Please enter your employee code");
if (employeecode == "L" || employeecode == "l") {
lecturecode = parseInt(prompt("Please enter your Lecturer Qualification Code"))
if (lecturecode == "M" || lecturecode == "m"){
alert("Your Pay per Hour is 5 with a teaching allowance of 00 per month");
}
else if (lecturecode == "B" || lecturecode == "b"){
alert("Your Pay per Hour is 5 with a teaching allowance of 50 per month");
}
}
你在 lecturecode 上有一个 parseInt,但正在使用一个 if 语句来寻找一个字母。
lecturecode = prompt("Please enter your Lecturer Qualification Code")//you had parseint here