[Solved] Javascript round down whole number


You can still use Math.floor, and simply shift the answer by an order of magnitude:

const moreFloor = n => Math.floor (n / 10) * 10 || n;

// (or if you prefer...)
function moreFloor (n) {
    return Math.floor (n / 10) * 10 || n;
}

Just to clarify, the || n at the end of the expression is due to the particular requirement in the question to not round down any number less than ten. If readers want moreFloor(9) === 0, you can omit that part.

solved Javascript round down whole number