function nextSequence() {
var randomNumber = (Math.floor(Math.random() * 3) 1);
}
我在控制臺上運行了這個但只是未定義我不知道這有什么問題。任何幫助表示贊賞
uj5u.com熱心網友回復:
如果你想在函式之外使用這個數字,你需要從函式體中回傳它,然后呼叫函式本身:
function nextSequence() {
return Math.floor(Math.random() * 3) 1;
}
const num = nextSequence();
console.log(num);
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/450034.html
標籤:javascript 功能 变量 变量
下一篇:如果字串陣列部分匹配,則過濾
