SOURCE

function divide(min, max, partNum) {
    let ret = [];
    let step = Math.floor((max + 1 - min) / partNum) || 1;
  	let left = max + 1 - min - step * partNum;
    for (let i = min; i <= max;) {
      	if (left > 0) {
          left--;
          s = step + 1;
        } else {
          s = step
        }
      	ret.push({
          min: i,
          max: i + s - 1 > max ? max : i + s - 1
        });
        i += s;
    }
    return ret;
}

console.log(JSON.stringify(divide(1, 2, 10)));
console 命令行工具 X clear

                    
>
console