/**
* Example: (57, 10) => 60
* @param {Number} number
* @param {Number} precision
* @returns {Number}
*/
function roundUp(number, precision) {
return Math.ceil(number / precision) * precision;
}
/**
* Example: (57, 10) => 50
* @param {Number} number
* @param {Number} precision
* @returns {Number}
*/
function roundDown(number, precision) {
return Math.floor(number / precision) * precision;
}
alert(roundUp(301, 5));
alert(roundDown(301, 5));