Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

syntax - How do I convert a float number to a whole number in JavaScript?

### please check the source for in detail explanation ###
var intvalue = Math.floor( floatvalue );
var intvalue = Math.ceil( floatvalue ); 
var intvalue = Math.round( floatvalue );

// `Math.trunc` was added in ECMAScript 6
var intvalue = Math.trunc( floatvalue );
Source by worcraft-algeria-dz.com #
 
PREVIOUS NEXT
Tagged: #syntax #How #I #convert #float #number #number
ADD COMMENT
Topic
Name
9+3 =