var num1 = prompt("Enter first number: ", "number");
var num2 = prompt("Enter second number: ", "number");
if (num1 > num2) {
document.write("<p>" + num1 + " is greater than " + num2 + "</p>");
} else {
document.write("<p>" + num2 + " is greater than " + num1 + "</p>");
}
当我当时执行此代码时,它每次都执行 else 部分,那么它的解决方案是什么?非常感谢你。