diff --git a/assignments/bmi_calculator/bmi_calculator.js b/assignments/bmi_calculator/bmi_calculator.js index 0cdd351..9669ad7 100644 --- a/assignments/bmi_calculator/bmi_calculator.js +++ b/assignments/bmi_calculator/bmi_calculator.js @@ -1,6 +1,16 @@ // This function should return the BMI for a person function BMICalculator(mass, height) { // Write your code here + if (mass<=0){ + return "INVALID INPUT" + } + else if (height<=0){ + return "INVALID INPUT" + } + else{ + BMI=mass/(height*height) + return BMI + } } module.exports = BMICalculator;