js arrondir au superieur code example
Example 1: js arrotondare superiore numero
function ceilTo(value, places){
var power = Math.pow(10, places);
return Math.ceil(value * power) / power;
}
function floorTo(value, places){
var power = Math.pow(10, places);
return Math.floor(value * power) / power;
}
Example 2: js arrotondare superiore numero
var myNum = 2/3;
var multiplier = 100;
var a = Math.round(myNum * multiplier) / multiplier;
var b = Math.ceil (myNum * multiplier) / multiplier;
var c = Math.floor(myNum * multiplier) / multiplier;