Last active
December 14, 2015 14:49
-
-
Save gnrlbzik/5103046 to your computer and use it in GitHub Desktop.
Round up number for range in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var max = 128, | |
maxLength = max.toString().length > 1 ? max.toString().length : 2, | |
maxRoundedUp = Math.ceil(max/Math.pow(10,maxLength) * 10) * Math.pow(10,maxLength-1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment