我不明白为什么从数字变量减法不起作用。我的代码如下。减法不适用于一个变量
function Check() {
var Viewer = document.getElementById("Viewer");
var TrysLeft = 3;
if (Viewer.value == Num) {
alert("Correct");
} else {
TrysLeft - 1;
alert("Sorry you got the combo wrong! You have " + TrysLeft + " Trys left before the combo is reset");
}
}
这只是改变的变量 - 1 – CDW
的答案删除空格,以便它的'TrysLeft - = 1' – SparkyRobinson