HTML/CSS/JavaScript 解法, 执行用时: 841ms, 内存消耗: 77772KB, 提交时间: 2020-10-29
{"css":"","js":"function square(arr) {\n var sq = []; \n for(var i in arr)\n {\n sq.push(arr[i]*arr[i]);\n }\n return sq;\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 842ms, 内存消耗: 77772KB, 提交时间: 2021-05-21
{"css":"","js":"function square(arr) { \n return arr.map(index=>Math.pow(index,2))\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 842ms, 内存消耗: 77772KB, 提交时间: 2020-12-24
{"css":"","js":"function square(arr) {\n var newarr=arr.slice(0);\n for(var i=0;i<newarr.length;i++){\n newarr[i]=newarr[i]*newarr[i];\n }\n return newarr;\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 843ms, 内存消耗: 77772KB, 提交时间: 2021-06-13
{"css":"","js":"function square(arr) {\n //声明一个新的数组存放结果\n var a = [];\n arr.forEach(function(e){\n //将arr中的每一个元素求平方后,加入到a数组中\n a.push(e*e);\n });\n return a;\n }","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 843ms, 内存消耗: 77772KB, 提交时间: 2021-03-18
{"css":"","js":"function square(arr) {\nreturn arr.map((item)=>{\n return item*item\n})\n}","html":"","libs":[]}