trunc
The trunc() method truncates the decimal part of a number, returning only the integer part. Unlike floor(), it behaves the same for positive and negative numbers by simply removing the decimals.
Interactive example
Syntax
typescript
function trunc<
GenericInput extends number,
>(input: GenericInput): numberParameters
input: The number whose decimal part you want to truncate.
Return value
The integer part of the given number (removes decimals without rounding).
