Created
February 5, 2022 13:24
-
-
Save neysidev/161bede823fa3c46d6e5a345e5eb2d68 to your computer and use it in GitHub Desktop.
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
| /** | |
| * Calculate percentage | |
| * | |
| * @param {number} percent - The percentage to be converted to a decimal | |
| * @param {number} total - total number of items | |
| * | |
| * @example (50 / 100) * 300 => 150 | |
| * @returns {number} percentage value | |
| */ | |
| function percentage(percent: number, total: number): number { | |
| return (percent / 100) * total | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment