BMI Calculator : calculate your perfect weight according to your height

BMI Calculator

WHO classsification of BMI and bodyweight
WHO classsification of BMI and bodyweight

Kilograms
Grams
Pounds

Meters
Centimeters
Feet
Inches

BMI Range (kg/m2) BMI Range (lb/ft2) Category
< 18.5 < 0.703 Underweight
18.5 – 24.9 0.703 – 0.956 Normal weight
25 – 29.9 0.957 – 1.106 Overweight
30 – 34.9 1.107 – 1.286 Obese I
35 – 39.9 1.287 – 1.473 Obese II
≥ 40 ≥ 1.474 Obese III

Comment your findings below.

function calculateBMI() {
var weight = parseFloat(document.getElementById(‘weight’).value);
var height = parseFloat(document.getElementById(‘height’).value);
var weightUnit = document.getElementById(‘weightUnit’).value;
var heightUnit = document.getElementById(‘heightUnit’).value;
var bmi;

if (weightUnit === ‘g’) {
weight = weight / 1000;
} else if (weightUnit === ‘lb’) {
weight = weight * 0.453592;
}

if (heightUnit === ‘cm’) {
height = height / 100;
} else if (heightUnit === ‘ft’) {
height = height * 0.3048;
} else if (heightUnit === ‘in’) {
height = height * 0.0254;
}

bmi = weight / (height * height);

var resultElement = document.getElementById(‘result’);
resultElement.innerHTML = ‘Your BMI: ‘ + bmi.toFixed(2) + ‘‘;

var referenceTable = document.getElementById(‘referenceTable’);
var category = ”;

if (bmi = 18.5 && bmi = 25 && bmi = 30 && bmi = 35 && bmi < 40) {
category = 'Obese II';
resultElement.style.color = '#ff3300';
} else {
category = 'Obese III';
resultElement.style.color = '#ff0000';
}

resultElement.innerHTML += '
Category: ‘ + category + ‘‘;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

[instagram-feed]
UTI complete slides