Divide the number by 10, round the result and multiply it with 10 again, for example:
33 / 10 = 3.33.3 rounded = 33 × 10 = 30
console.log(Math.round(prompt('Enter a number', 33) / 10) * 10);
Divide the number by 10, round the result and multiply it with 10 again, for example:
33 / 10 = 3.33.3 rounded = 33 × 10 = 30console.log(Math.round(prompt('Enter a number', 33) / 10) * 10);