求数组中任意三个点的面积最大的值
function aeraS(points) { let res = []; for (let i= 0;i< points.length-2; i++) { for (let j = i+1; j < points.length-1; j++) { for (let k = 0; k < points.length; k++) { // S=(x1y2-x1y3+x2y3-x2y1+x3y1-x2y2)。 res.push(points[i][0]*points[j][1]-points[i][0]*points[k][1] // +x2y3-x2y1 +points[j][0]*points[k][1]-points[j][0]*points[i][1] // +x3y1-x2y2 +points[k][0]*points[i][1]-points[j][0]*points[j][1]) } } } res = res.sort((a,b)=>b-a) console.log(res); return res[0] } console.log(aeraS([[0,0],[0,1],[1,0],[0,2],[2,0]]));