我不明白爲什麼從數字變量減法不起作用。我的代碼如下。減法不適用於一個變量
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