【发布时间】:2017-08-15 23:28:09
【问题描述】:
假设我有这 3 个数组:
Shirts [White, Navy, Light Blue, Gray],
Pants [Black, Navy, Gray],
Ties [Houndstooth, Polka Dot, Herringbone, Solid]
我应该怎么做才能得到这个结果
White Shirt with Black Pants and a Houndstooth Tie,
White Shirt with Black Pants and a Polka Dot Tie,
White Shirt with Black Pants and a Herringbone Tie,
White Shirt with Black Pants and a Solid Tie,
White Shirt with Navy Pants and a Houndstooth Tie,
White Shirt with Navy Pants and a Polka Dot Tie,
White Shirt with Navy Pants and a Herringbone Tie,
White Shirt with Navy Pants and a Solid Tie,
And so on,
And so on...
【问题讨论】:
-
我对JS有点生疏,所以请解释一下你是做什么的。
-
你有这方面的代码吗?如果没有,请先写一些并尝试一下,然后我们会看到我们可以做些什么来提供帮助。
-
您的问题到底是什么?你试过什么?您发布的数组有 75 种可能的组合。
-
最基本的解决方案可能是使用 3 个嵌套的
for循环来遍历所有内容
标签: javascript html combinations permutation calculator