Created
June 24, 2020 13:50
-
-
Save dohoons/a240c36afeec8739d94d85fc98c1a7cb to your computer and use it in GitHub Desktop.
getBeautyWeight
This file contains 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
function getBeautyWeight(height, sex = 'men') { | |
const standardHeight = { | |
men: 175, | |
female: 163, | |
}; | |
const standardRatio = { | |
men: 62.7 / standardHeight.men, | |
female: 49.2 / standardHeight.female, | |
}; | |
const standardWeight = { | |
men: 0.02, | |
female: 0.0147, | |
}; | |
const ratio = standardRatio[sex] + (height - standardHeight[sex]) / 10 * standardWeight[sex]; | |
const beautyWeight = Math.round(height * ratio * 10) / 10; | |
return beautyWeight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment