小编Wil*_*ner的帖子

我如何在for循环中执行此操作?

我被告知我的幸运数字math.random代码是重复代码,并将其与输出字符串或用户for循环组合.我如何在for循环中执行此操作?

function showFortune() {
    // Quotes to grab from array.
    var quotes = new Array(5)
    quotes[0] = "The road to riches is paved with homework.";
    quotes[1] = "Ignore your previous fortune.";
    quotes[2] = "Avoid taking unnecessary gambles.";
    quotes[3] = "You love peace.";
    quotes[4] = "A friend asks only for your time and not your money.";

    // Spacer for between numbers
    var space = ('      ')

    // Get random lucky numbers
    var number1 = Math.floor(Math.random() * 60 + 1);
    var number2 …
Run Code Online (Sandbox Code Playgroud)

javascript

-3
推荐指数
1
解决办法
130
查看次数

标签 统计

javascript ×1