Learn how to remove the decimal part of a number in JavaScript.
Remove Decimals
You can use the Math.trunc() method to remove the decimals of a number:
Example
js
let x = Math.trunc(8.7512356);
// 8
Tip: Learn more about the Math.trunc() method in the JavaScript Reference.