#consol.log("Day-2");JavaScript Function ,Math.trunc()

Naman KumarNaman Kumar
1 min read

Table of contents

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
0
Subscribe to my newsletter

Read articles from Naman Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Naman Kumar
Naman Kumar

student, Coder, Programmer