obj = [
{name: "obj1"},
{name: "obj2"},
{name: "obj3"}
]
我有这些元素,我想用这些元素创建不同的数组,比如第一个数组10x obj1,第二个数组9x obj1和1 obj2,第三个数组8x obj1和2x obj2,就像这样,我需要每种可能性:
arr1 = [
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"}
]
arr2 = [
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj2"}
]
arr3 = [
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj2"},
{name: "obj2"}
]
arr4 = [
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj1"},
{name: "obj2"},
{name: "obj2"},
{name: "obj2"}
]
.
.
.
我怎样才能做到呢
1条答案
按热度按时间o8x7eapl1#
下面的脚本可以正常工作。
希望这能有所帮助!