-1
我試圖隨機選擇一個選項使用Math.random()
這是我到目前爲止的代碼。如果語句原因:未捕獲SyntaxError:意外的令牌<
function randChoice() {
\t var chance = Math.floor(Math.random() * 100);
if (chance > -1 && < 50) {
console.log("Option 1"); // 1
} else if (crateId > 49 && < 71) {
console.log("Option 2"); // 2
} else if (crateId > 70 && < 91) {
console.log("Option 3"); // 3
}
}
當我運行它,我得到一個錯誤說Uncaught SyntaxError: Unexpected token <
。
我的語法有什麼問題?我一直在尋找至少一個小時,但我找不到任何有助於解決問題的跡象。
哇,謝謝!我完全錯過了! – Marbles