翻翻过去那场雪
假设坐标是二维数组的形式:const data = [ [101, 108], [100, 108],]const isDataRect = data => { let xMin = +Infinity, yMin = +Infinity, xMax = -Infinity, yMax = -Infinity; data.forEach(coord => { let [x, y] = coord; x = Number(x); y = Number(y); xMin = Math.min(xMin, x); yMin = Math.min(yMin, y); xMax = Math.max(xMax, x); yMax = Math.max(yMax, y); }) return data.length === (xMax - xMin + 1) * (yMax - yMin + 1)}console.log(isDataRect(data))