JavaScript Math trunc() Method Last Updated : 15 Jul, 2024 Comments Improve Suggest changes Like Article Like Report The Math.trunc() method in JavaScript returns the integer part of a number by removing its fractional part. It essentially truncates the decimal portion of a number towards zero, resulting in an integer. For positive numbers, it's equivalent to flooring the number, while for negative numbers, it's akin to ceiling the number.Syntax:Math.trunc(value)Parameters:This method accepts a single parameter as mentioned above and described below:value. It is the floating-point number that is to be sent to the Math.trunc() function.Return Value:The Math.trunc() method returns the integer part of the given number. More codes for the above method are as follows: Example 1: Truncating Positive NumberWhen a positive float number passed as a parameter JavaScript console.log(Math.trunc(15.56)); Output15 Example 2: Truncating Negative NumberWhen a negative number of a float type is passed as a parameter JavaScript console.log(Math.trunc(-15.56)); Output-15 Example 3: Passing Number between 0 and 1.Here, we are passing number between 0 and 1. JavaScript console.log(Math.trunc(0.236)); Output0 We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.Supported Browsers:Chrome 51 Edge 15 Firefox 54 Safari 10 Opera 38 Comment More info S Shubrodeep Banerjee Follow Improve Article Tags : Misc JavaScript Web Technologies javascript-math JavaScript-Methods +1 More Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings6 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in Javascript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)9 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readJavascript Scope3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like