FED40. 添加元素
描述
示例1
输入:
[1, 2, 3, 4], 10
输出:
[1, 2, 3, 4, 10]
HTML/CSS/JavaScript 解法, 执行用时: 859ms, 内存消耗: 77848KB, 提交时间: 2020-11-23
{"css":"","js":"function append(arr, item) {\n return arr.concat([item])\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 860ms, 内存消耗: 77772KB, 提交时间: 2020-12-25
{"css":"","js":"function append(arr, item) {\nvar brr = arr.concat([item]);\n return brr\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 860ms, 内存消耗: 77900KB, 提交时间: 2020-11-23
{"css":"","js":"function append(arr,item){\n return arr.concat(item)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 860ms, 内存消耗: 77904KB, 提交时间: 2020-12-14
{"css":"","js":"function append(arr, item) {\n return arr.concat([item]);\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 861ms, 内存消耗: 77780KB, 提交时间: 2020-12-21
{"css":"","js":"function append(arr, item) {\n let tempArr = arr.slice()\n tempArr.push(item)\n return tempArr\n}","html":"","libs":[]}