Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

javaScript Math.trunc()

Math.trunc(4.9);
Math.trunc(4.7);
Math.trunc(4.4);
Math.trunc(4.2);
Math.trunc(-4.2);
Comment

define math.trunc() method in javascript

// Math.trunc()

// The Math. trunc() function returns the integer part of a number by removing any fractional digits.

// EXAMPLE : 1
let num = Math.trunc(99.75);
console.log(num);
// OUTPUT: 99

// EXAMPLE : 2
let num_1 = Math.trunc(-57.43);
console.log(num_1);
// OUTPUT: 57
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to find largest number in array in javascript 
Javascript :: get value of radio button javascript 
Javascript :: sum elements in list with same name js 
Javascript :: jquery active menu 
Javascript :: js add html element to div 
Javascript :: how to make apk of react native app 
Javascript :: short if 
Javascript :: toast in angular not working 
Javascript :: add parameter to url without reload jquery 
Javascript :: show tooltip automatically 
Javascript :: ignore eslint warning one line 
Javascript :: jquery addclass 
Javascript :: add attribute in select option 
Javascript :: jsonarray add jsonobject 
Javascript :: fixed menu reactjs 
Javascript :: reactjs hello world 
Javascript :: set a value in session using javascript 
Javascript :: distance to km javascript 
Javascript :: cypress check attribute for each element 
Javascript :: how to check value is array or not in javascript 
Javascript :: http to https redirect express js 
Javascript :: event.preventdefault is not a function jquery 
Javascript :: javas script add list 
Javascript :: show hidden element javascript 
Javascript :: express receive post 
Javascript :: javascript override shortcut 
Javascript :: js and 
Javascript :: Accessing $route.params in VueJS 
Javascript :: cordova android close app with back button 
Javascript :: how to run commands in the command prompt using javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =