📜  在反应中连接两个数组 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:17.851000             🧑  作者: Mango

代码示例3
var array1 = [1,2,3,4];
var array2 = [5,-6,7,8.5];

const concatArr = (arr1, arr2, sep) => arr1.map(function (num, idx) {
  return num.toString().concat(sep,(arr2[idx]).toString())
});

console.log(concatArr(array1,array2,"#"))// ["1#5", "2#-6", "3#7", "4#8.5"]