Skip to content

Commit f53975c

Browse files
refactored the calculateBMI to return a string instead of a number
1 parent 2b62802 commit f53975c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
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 their Body Mass Index to 1 decimal place
15+
// It should return a string of their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
1818
let result = (weight/(height*height));
19-
return Number(result.toFixed(1));
19+
result= Number(result.toFixed(1));
20+
return String(result)
2021

2122

2223
}

0 commit comments

Comments
 (0)