Two thirds of the adult population in the United States and at least half the populations of many other developed countries are currently overweight or obese 2. Commonly accepted body mass index ranges are: The body mass index is an attempt to quantify the amount of tissue mass (muscle, fat, and bone) in an individual, and then categorize that person as underweight, normal weight, overweight, or obese based on that value. The CDC has a BMI percentile calculator for children and teens at 1.
#Body mass index calculator equation free
To find out about your body mass index (BMI), you can use a FREE online BMI calculators from the Centers for Disease Control and Prevention (CDC) :įor children and adolescents (younger than 20 years of age), overweight and obesity are based on the Centers for Disease Control and Prevention’s (CDC’s) BMI-for-age growth charts, which are available at ( ). To calculate your body mass index, you divide your body weight in kilograms by your height in meter squared (commonly expressed as kg/m 2), see the body mass index formula below. In others, such as elderly people, body mass index may appear normal even though muscle has been lost with aging. As a result, some people, such as heavily muscled athletes, may have a high BMI even though they don’t have a high percentage of body fat. Nor does it distinguish between lean body mass and fat mass. Moreover, your Body Mass Index (BMI) does not take into account your age, gender or muscle mass. The World Health Organization defines overweight as a body mass index equal to or more than 25 – 29.9 kg/m 2 and obesity as a BMI equal to or more than 30.Īdults with a body mass index of 35 or higher and an obesity-related condition (e.g., diabetes) and adults with a BMI of 40 kg/m 2 or higher are considered severely obese. For individuals, it is one of many factors that should be considered in evaluating healthy weight, along with waist size, body fat composition, waist circumference, blood pressure, cholesterol level and blood sugar. The body mass index (BMI) is defined as the body mass divided by the square of the body height, and is universally expressed in units of kg/m 2, resulting from mass in kilograms and height in meters.īMI is considered an important measure for understanding population trends. The body mass index (BMI) or Quetelet index is a value derived from the mass (weight) and height of an individual. Body Mass Index for Men and Women Adults.innerHTML property is used to set the inner text of the span here. Use the same like document.getElementById("comment").innerHTML = "Underweight" You cannot use like document.getElementById("comment").value = "Underweight" If (BMI = 18.5 & BMI = 25 & BMI 30) document.getElementById("comment").innerHTML = "Overweight" And i don't understand what you wish to accomplish by the statement document.getElementById("answer").value = output so unless you explain that, i have commented it.ĭocument.getElementById("output").innerHTML = Math.round(BMI * 100)/100 and document.getElementById("comment") results in an empty set(null), hence the error : Cannot set property value of null. The things wrong with what you have done, is that the var output is not assigned any value.
If (output = 18.5 & output = 25 & output 30)ĭocument.getElementById("comment").innerText = "Overweight" Var BMI = Math.round(weight / Math.pow(height, 2) * 10000) ĭocument.getElementById("output").innerText = Math.round(BMI * 100) / 100 var BMI = weight /Math.pow(height, 2)*10000 Var weightunits = document.getElementById("weightunits").value Var weight = Number(document.getElementById("weight").value) Var heightunits = document.getElementById("heightunits").value Var height = Number(document.getElementById("height").value) If (output=18.5 & output=25 & output30)ĭocument.getElementById("comment").value = "Overweight" ĭocument.getElementById("answer").value = output Var weightunits=document.getElementById("weightunits").value Var weight=Number(document.getElementById("weight").value) Var heightunits=document.getElementById("heightunits").value
Var height=Number(document.getElementById("height").value) Please can someone help me fix my calculator, I know there are problems with my if statements? Thanks.
There should be a message shown underneath: your bmi is:, and then the message underneath is this means you are: according to the BMI calculated above. I am trying to create a basic HTML/JavaScript BMI calculator.