可以利用 Math.round() 方法将计算结果四舍五入取整 var result = Math.round(random / 200 * 100); // 将 random 除以 200,然后乘以 100,最后四舍五入取整 console.log(result); // 输出计算结果取整后的值