FED44. 数组合并
描述
合并数组 arr1 和数组 arr2。不要直接修改数组 arr,结果返回新的数组示例1
输入:
[1, 2, 3, 4], ['a', 'b', 'c', 1]
输出:
[1, 2, 3, 4, 'a', 'b', 'c', 1]
HTML/CSS/JavaScript 解法, 执行用时: 858ms, 内存消耗: 77816KB, 提交时间: 2020-11-23
{"css":"","js":"function concat(arr1, arr2) {\n return res = arr1.concat(arr2)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 858ms, 内存消耗: 77828KB, 提交时间: 2020-12-12
{"css":"","js":"function concat(arr1, arr2) {\n return arr1.concat(arr2)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 861ms, 内存消耗: 77840KB, 提交时间: 2020-12-23
{"css":"","js":"function concat(arr1, arr2) {\n return [...arr1, ...arr2]\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 862ms, 内存消耗: 77772KB, 提交时间: 2020-11-23
{"css":"","js":"function concat(arr1, arr2) {\n return arr1.concat(arr2)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 862ms, 内存消耗: 77792KB, 提交时间: 2020-12-25
{"css":"","js":"function concat(arr1, arr2) {\n \n return arr1.concat(arr2);\n}","html":"","libs":[]}