JavaScript如何计算数组中的元素平均值答:var arr = [5,8,2,3,7,6,9,1,4,8,3,0];var sum=0;for(var i = 0; i < arr.length; i++){ sum += arr[i];}var mean = sum / arr.length;console.log(mean);
...放在一个小数组里面,然后其他不变 用JavaScript怎么写?答:window.onload = function (){var varialbe = [1,2,3,4,5,3,6,3,1,2,6];var temp = new Array;var result = new Array;temp.push(varialbe[0]);for (var i = 1; i<varialbe.length; i++) { var flag = 0; for(var j = 0; j<temp.length; j++){ if (varial...