我需要将两个数组合并成一个数组。我有代码,但它不能按预期工作 - 它正在一个接一个地合并它们,但我需要将这些值联系起来。基于索引使用javascript合并多个数组
<html>
<head>
<title></title>
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
</head>
<body>
<div id="result"></div>
<script type="text/javascript">
var array1 = [1, 2, 3, 4];
var array2 = ["a", "b", "c", "d"];
var newArray = $.merge(array1, array2);
$("#result").html(newArray);
//the result its 1234absd
//ineed result like 1a,2b,3c,4d
</script>
</body>
</html>
如果什么两个数组的长度不同? –
如果你需要以这种方式合并2个以上的数组,我已经在我的答案下面创建了一个函数 –