Skip to content

Commit 82fccd4

Browse files
committed
3-mandatory-implement 1.bmi.js updated output to return a number and used modern js to square the height
1 parent 20a496c commit 82fccd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
// return the BMI of someone based off their weight and height
1919
function calculateBMI(weight, height) {
20-
return (weight/(Math.pow(height, 2))).toFixed(1);
21-
20+
return Number((weight / (height ** 2)).toFixed(1));// returns a number
21+
// return (weight/(Math.pow(height, 2))).toFixed(1);// returns a string
2222
}
2323
console.log(calculateBMI(100, 1.6)); //print 39.1
2424
console.log(calculateBMI(55, 1.6)); //print 21.5

0 commit comments

Comments
 (0)