Skip to content

Instantly share code, notes, and snippets.

@dohoons
Created June 24, 2020 13:50
Show Gist options
  • Save dohoons/a240c36afeec8739d94d85fc98c1a7cb to your computer and use it in GitHub Desktop.
Save dohoons/a240c36afeec8739d94d85fc98c1a7cb to your computer and use it in GitHub Desktop.
getBeautyWeight
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