JavaScript Round to the nearest multiple of 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.
var roundedValue = Math.round(myValue / 5) * 5;
Posted by
Want to return the favor?

Share your JavaScript code snippets:

  • Get some recognition & link back to your site.
Submit | Browse

Most Recent javascript snippets

Most Viewed

The FitDesk Under Desk Elliptical