Category: Number function
This function returns the integer part of a number.
Argument | Type | Description |
---|---|---|
number | Number | The value, usually fractional, to be truncated. |
Return value type: Number (Integer)
This function does not perform any rounding process, it simply drops any decimal portion present in number.
Truncating a whole number (integer) simply returns that integer value.
truncate(-10.99) //Returns -10
truncate( 10.99) //Returns 10
truncate(100.1) //Returns 100
truncate(-54.78294) //Returns -54