gpt4 book ai didi

javascript - 将多个数组拼接成一个数组,不重复

转载 作者:数据小太阳 更新时间:2023-10-29 05:46:19 25 4
gpt4 key购买 nike

<分区>

我想将 3 个数组的值推送到一个新数组中而不重复相同的值

var a = ["1", "2", "3"];
var b = ["3", "4", "5"];
var c = ["4", "5", "6"];
var d = [];

function newArray(x, y, z) {
for(var i = 0; i < d.length; i++) {
if(d.length == -1) {
d[i].push(a[i])
}
}

for(var i = 0; i < d.length; i++) {
if(d.length == -1) {
d[i].push(y[i])
}
}

for(var i = 0; i < d.length; i++) {
if(d.length == -1) {
d[i].push(z[i])
}
}
}

newArray(a, b, c);

d = ["1", "2", "3", "4", "5", "6"];

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com