不确定这个问题的最佳标题,所以欢迎任何修订建议......
假设我有 1 个 javascript 数组,如下所示:
group[g1] = [v1,v2,v3]
group[g2] = [a1,a2,a3]
group[g3] = [b1,b2,b3]
and so on... ad infinitum
我想重新安排这个以获得
newgroup[z] = [v1,a1,b1]
newgroup[y] = [v1,a1,b2]
newgroup[x] = [v1,a1,b3]
newgroup[w] = [v1,a2,b1]
newgroup[v] = [v1,a2,b2]
newgroup[u] = [v1,a2,b3]
newgroup[t] = [v1,a3,b1]
newgroup[s] = [v1,a3,b2]
newgroup[r] = [v1,a3,b3]
newgroup[q] = [v2,a1,b1]
newgroup[p] = [v2,a1,b2]
newgroup[o] = [v2,a1,b3]
newgroup[n] = [v2,a2,b1]
newgroup[m] = [v2,a2,b2]
newgroup[h] = [v2,a2,b3]
newgroup[g] = [v2,a3,b1]
newgroup[f] = [v2,a3,b2]
newgroup[d] = [v2,a3,b3]
newgroup[q] = [v3,a1,b1]
newgroup[p] = [v3,a1,b2]
newgroup[o] = [v3,a1,b3]
newgroup[n] = [v3,a2,b1]
newgroup[m] = [v3,a2,b2]
newgroup[h] = [v3,a2,b3]
newgroup[g] = [v3,a3,b1]
newgroup[f] = [v3,a3,b2]
newgroup[d] = [v3,a3,b3]
IE。列出对这些项目进行分组的不同方式的所有排列理想情况下,这将是动态的,因此无论每个组数组中有多少组元素......它也可以工作。然后我可以加入新闻组并将它们链接在一起,为 jquery 制作一个大型选择器。
请帮助...它现在超出了我的范围!