JavaScript trunc() Method
Definition and Usage
The trunc() method returns the integer part of a number.
Note: This method will NOT round the number up/down to the nearest ingeger, but simply remove the decimals.
Browser Support
Method | |||||
---|---|---|---|---|---|
trunc() | 38 | 12 | 25 | 8 | 25 |
Syntax
Math.trunc(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. A number |
Technical Details
Return Value: | A Number |
---|---|
JavaScript Version: | ECMAScript 6 |
❮ JavaScript Math Object