var roundedValue = Math.round(myValue / 5) * 5;
You can easily round to the nearest multiple of five by first dividing your value by 5, then rounding it. Afterwards, just multiply by 5 to get your answer.
Snippet Viewed 202 times.
- Get some recognition & link back to your site.