javascript math.trunc code example
Example 1: js math.trunc
The Math.trunc() function
returns the integer part of a number by removing any fractional digits.
console.log(Math.trunc(13.37));
// expected output: 13
console.log(Math.trunc(42.84));
// expected output: 42
console.log(Math.trunc(0.123));
// expected output: 0
console.log(Math.trunc(-0.123));
// expected output: -0
Example 2: javascript trunc
Math.trunc(13.37); // 13
Math.trunc(42.84); // 42
Math.trunc(0.123); // 0