The mathTrunc() function returns the integer part of a number by removing any fractional digits.
Unlike the other three Math methods: Math.floor(), Math.ceil() and Math.round(), the way mathTrunc()
works is very simple. It truncates (cuts off) the dot and the digits to the right of it, no matter
whether the argument is a positive or negative number.
The argument passed to this method will be converted to number type implicitly.
The
mathTrunc()
function returns the integer part of a number by removing any fractional digits. Unlike the other three Math methods: Math.floor(), Math.ceil() and Math.round(), the waymathTrunc()
works is very simple. It truncates (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negative number. The argument passed to this method will be converted to number type implicitly.