We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad3dfa9 commit b2a5048Copy full SHA for b2a5048
Sprint-2/3-mandatory-implement/1-bmi.js
@@ -17,12 +17,7 @@
17
function calculateBMI(weight, height) {
18
let sqh = height * height;
19
let bmi = weight / sqh;
20
- let bmiS = bmi.toString();
21
22
- if (bmiS.includes(".")) {
23
- let dotBmiS = bmiS.indexOf(".");
24
- return Number(bmiS.slice(0, dotBmiS + 2));
25
- }
26
- return bmi;
+ return bmi.toFixed(1);
27
}
28
console.log(calculateBMI(20, 1.79));
0 commit comments