在 udemy 上关于 JavaScript 的在线课程。试图对我学到的东西进行编码。我收到一个未定义的错误。Visual Studio 2012 Pro 说代码已找到,但是当我运行代码时出现错误。
<script type="text/javascript">
var numericalGrade = 82;
var letterGrade;
function myResaults() {
document.write("Your score is " + numericalGrade + "%. Your grade will be a " + letterGrade + ".<br />");
}
if (numericalGrade >= 90) {
letterGrade = "A";
document.write(myResaults() + " Excellent, you passed this course with flying colors...");
}
else if (numericalGrade >= 80) {
letterGrade = "B";
document.write(myResaults() + " Excellent, you passed this course with a great grade..");
}
else if (numericalGrade >= 70) {
letterGrade = "C";
document.write(myResaults() + " Congratulations, you passed this course...");
}
else if (numericalGrade >= 60) {
letterGrade = "D";
document.write(myResaults() + " You revived a grade that will not permit you to pass this course. You can retake this course at a later date.");
}
else {
letterGrade = "F";
document.write(myResaults() + "You failed this course. You can retake this course at a later date.");
}
</script>
那么我做错了什么。我对 JavaScript 编码非常陌生。