JavaScript trunc() Method
- Previous Page tanh()
- Next Page abs()
- Go to the Previous Level JavaScript Math Reference Manual
Definition and Usage
trunc()
The method returns the integer part of the number.
Note:This method does not round the number up or down to the nearest integer, it simply removes the decimal part.
Syntax
Math.trunc(x)
Parameter Value
Parameter | Description |
---|---|
x | Required. Number. |
Technical Details
Return Value: | Numbers. |
---|---|
JavaScript Version: | ECMAScript 6 |
Browser Support
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
trunc() | 38 | 12 | 25 | 8 | 25 |
Related Pages
Tutorial:JavaScript Mathematics
- Previous Page tanh()
- Next Page abs()
- Go to the Previous Level JavaScript Math Reference Manual