📜  js bmi 计算器 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:19.478000             🧑  作者: Mango

代码示例1
// 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);