Last active
June 1, 2016 04:29
-
-
Save codeBelt/d9f05fe68964d20eb007 to your computer and use it in GitHub Desktop.
Gets the value between min and max by percentage
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 = 150; | |
| var MIN = 0; | |
| var PERCENT = 0.5; | |
| var value = ((MAX - MIN) * PERCENT) + MIN; | |
| var percent = (value - MIN) / (MAX - MIN); | |
| console.log(value); // 75 | |
| console.log(percent); // 0.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment