Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Sprint-2/3-mandatory-implement/1-bmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// Then when we call this function with the weight and height
// It should return their Body Mass Index to 1 decimal place

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
}
function calculateBmi(weight, height) {
const squareHeight = height * height;
const divide = weight / squareHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bmi in lowercase is a more meaningful name than divide.

// let BMI = divide.toFixed(2);
return Number(divide.toFixed(1));
}
console.log(calculateBmi(70, 1.73));
console.log(typeof calculateBmi(70, 1.73));