Table of contents
No headings in the article.
The Math.trunc() a static JavaScript function accessed using a Math object is used to get the integer portion of a floating-point number. it eliminates all fractional digits and truncates the number to the right of it. it only takes a single parameter (number) and outputs the integer portion of the provider number. it is supported by all browsers.
console.log(Math.trunc(15.56)); console.log(Math.trunc(15.56));
//output 15
//output -123