var int = 10;
var float = parseFloat(int).toFixed(2);
console.log(float); // 10.00
var threedots = 8;
var float2 = parseFloat(threedots).toFixed(3);
console.log(float2); // 8.000
parseFloat("4").toFixed(2)
(3).toFixed(1)
### 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 );