Posts Tagged javascript round

Javascript – Round numbers to some decimal places

Javascript’s Math.round function allows a user to round a float to an integer. But most of the time we need some function that’ll let us round the number to any decimal places we want. So here is the function that’ll solve your problem: function roundNumber(num,decimal){ var numerator = Math.round(num * Math.pow(10, decimal)); var denominator = […]


No Comments