Skip to content

Instantly share code, notes, and snippets.

@wedburst
Created October 23, 2020 18:07
Show Gist options
  • Select an option

  • Save wedburst/dfc3072fa55b85fc8e4ca705517305e4 to your computer and use it in GitHub Desktop.

Select an option

Save wedburst/dfc3072fa55b85fc8e4ca705517305e4 to your computer and use it in GitHub Desktop.
function bmiCalculator (weight, height) {
var interpretation = weight / Math.pow(height, 2);
return Math.round(interpretation);
}
var body = bmiCalculator(85,1.8);
if(body < 18.5 ){
console.log("your weight is: " + body + " You are underweight");
}
if(body >= 18.5 && body <= 24.9){
console.log("your weight is: " + body + " so you have a normal weight");
}
// if(body > 24.9){
// console.log("your weight is: " + body + " You are normal");
// }
if(body > 25.9 && body < 29.9){
console.log("your weight is: " + body + " Overweight");
}
if(body > 30 && body < 34.9){
console.log("your weight is: " + body + " Obese");
}
if(body > 35){
console.log("your weight is: " + body + " Extramely obese");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment