File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ console.log(`The last digit of 105 is ${getLastDigit(105)}`);
3737console . log ( `The last digit of 806 is ${ getLastDigit ( 806 ) } ` ) ;
3838
3939
40-
41-
4240// This program should tell the user the last digit of each number.
41+
4342// Explain why getLastDigit is not working properly - correct the problem
43+ //(A) The function `getLastDigit` needed to accept a parameter `num` in order to work properly.
Original file line number Diff line number Diff line change 1515// It should return their Body Mass Index to 1 decimal place
1616
1717function calculateBMI ( weight , height ) {
18- // return the BMI of someone based off their weight and height
19- }
18+ const heightSquared = height * height ;
19+ const bmi = weight / heightSquared ;
20+ return Number ( bmi . toFixed ( 1 ) ) ;
21+ }
22+
23+ //console.log(calculateBMI(80, 1.85)); // expected output: 23.4
You can’t perform that action at this time.
0 commit comments