Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create your function below this line.
- /* If my weight is 65Kg and my height is 1.8m, I should be able to call your function like this:
- var bmi = bmiCalculator(65, 1.8);
- bmi should equal around 20 in this case.
- */
- function bmiCalculator(yourWeight, yourHeight){
- console.log("Your BMI is " + calculator (yourWeight, yourHeight));
- }
- // function round(yourWeight, yourHeight) {
- // var roundOff = Math.round(yourWeight, yourHeight);
- // return roundOff;
- // }
- function calculator(yourWeight, yourHeight) {
- // var calc = yourWeight / (Math.sqrt(yourHeight));
- // return calc;
- var calc = (yourWeight) / (Math.pow(yourHeight, 2));
- return Math.floor(calc);
- }
- var bmi = bmiCalculator(65, 1.8);
Advertisement
Add Comment
Please, Sign In to add comment