学习如何在 JavaScript 中删除数字的小数部分。
您可以使用 Math.trunc() 方法删除数字中的小数:
Math.trunc()
let x = Math.trunc(8.7512356); // 8
亲自试一试
参考手册:JavaScript Math.trunc() 方法