Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js bmi calculator

// function that caclulates BMI
function bmiCalc(weight, height){

  var bmiResult = weight / Math.pow(height, 2);
  var roundedResult = Math.floor(bmiResult);

  return roundedResult;
}


// sample use
var bmiCalcResult = bmiCalc(65, 1.8);
console.log(bmiCalcResult);
 
PREVIOUS NEXT
Tagged: #js #bmi #calculator
ADD COMMENT
Topic
Name
7+6 =