math round to the nearest tenth javascript code example
Example 1: javascript round to nearest 10
var rounded = Math.round(number / 10) * 10
Example 2: round to nearest decimal javascript
function round(value, precision) {
var multiplier = Math.pow(10, precision || 0);
return Math.round(value * multiplier) / multiplier;
}