【问题标题】:Generate number combinations in Javascript在 Javascript 中生成数字组合
【发布时间】:2017-06-29 16:16:43
【问题描述】:

有人请我帮忙编写一个简单的数字生成脚本。该脚本应采用从 1 到 9 的数字数组作为输入。然后它应该计算并输出一个输出数组中所有可能的 3 数组合。

这里是 a link 到一个站点,该站点完全按照我们希望我们的脚本执行的方式生成和输出数字。

谢谢。

【问题讨论】:

  • 那么你有没有尝试过?

标签: javascript arrays combinations


【解决方案1】:

现在使用以下代码:

for(var a = 0; a < 10; a++) {
    for(var b = 0; b < 10; b++) {
        for(var c = 0; c < 10; c++) {
            var combination = a + '' + b + '' + c;
            if(checkCode(parseInt(combination))) {
                console.log("Password is: + combination)
            }
        }
    }
}

【讨论】:

    猜你喜欢
    • 2012-04-26
    • 1970-01-01
    • 1970-01-01
    • 2021-01-02
    • 2017-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多