Skip to content

Commit c35da0c

Browse files
committed
implement bmi.js
1 parent 038f2d7 commit c35da0c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎Sprint-3/3-mandatory-implement/1-bmi.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66

77
// squaring your height: 1.73 x 1.73 = 2.99
88
// dividing 70 by 2.99 = 23.41
9-
// Your result will be displayed to 1 decimal place, for example '23.4'.
9+
// Your result will be displayed to 1 decimal place, for example 23.4.
1010

1111
// You will need to implement a function that calculates the BMI of someone based off their weight and height
1212

1313
// Given someone's weight in kg and height in metres
1414
// Then when we call this function with the weight and height
15-
// It should return a string of their Body Mass Index to 1 decimal place
15+
// It should return their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
18+
return (weight / (height * height)).toFixed(1);
1919
}
20+
console.log(calculateBMI(90, 1.7));
21+
// return the BMI of someone based off their weight and height
22+
// return the BMI of someone based off their weight and height

0 commit comments

Comments
 (0)