更新时间:2023-02-26 19:06:07
这样应该可以使您到达某个位置(来自 this SO答案):
This should get you somewhere (from this SO answer):
if (nums.length %2 == 0) {
// even-length array (two middle elements)
var avg = (nums[(nums.length/2) - 1] + nums[nums.length/2]) /2;
}