## DEV Community 👩‍💻👨‍💻 is a community of 917,453 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

# Design a BMI Calculator using JavaScript

The Body Mass Index (BMI) Calculator can be used to calculate BMI values based on their height and weight. BMI is a fairly reliable indicator of body fatness for most people.

Formula:

BMI = (weight) / (height * height)

Here's JavaScript code

`````` function BMI(weight, height) {
return(weight / (height * height));
}

let bmiResult = BMI(57, 1.73736);
console.log(bmiResult);
`````` ## Top comments (7) GrahamTheDev

173.736m...that is a very tall person! 😜🤣

Especially at 57kg, they need to lose some weight! Andrew Bone

0.0018884053362648637 BMI, I think they need to put some on... GrahamTheDev • Edited on

I was kidding 😋 At 57kg very few people should need to lose weight!

I was trying to work out how thin they would have to be to be 173m tall and 57kg but I couldn't quite get it right, I think it is about 0.57cm wide! 🤣 Andrew Bone • Edited on

Let's do some maths 😁

``````985 kg/m3
weight = height(m) * width(m) * depth(m) * 985
57 = 173 * 0.41 * depth * 985
57 / 985 = 173 * 0.41 * depth
0.0579 (4dp) = 173 * 0.41 * depth
0.0579 = 70.93 * depth
depth = 8.1629775835330607641336528972226e-4m
depth = 0.0816cm (4dp)
``````

This is presuming average human density and a 'normal' shoulder width of 41cm.

😅 